SQL约束检查<>

问题描述 投票:0回答:1

我只想在关键字检查后知道符号<>是什么?

示例:

create table DistancesTbl(
   from varchar(100) not null,
   to varchar(100) not null,
   km smallint not null,
   primary key(from, to),
   constraint check_from_to check (from <> to),
   constraint check_distance check (km > 0)
);

在上一个查询中,这行是什么约束check_from_以检查(从<>到),确切地做?

谢谢!

mysql constraints ddl
1个回答
1
投票

这是not equal operator的另一个版本:

Not equal:
mysql> SELECT '.01' <> '0.01';
       -> 1
mysql> SELECT .01 <> '0.01';
       -> 0
mysql> SELECT 'zapp' <> 'zappp';
       -> 1

与使用!=相同

© www.soinside.com 2019 - 2024. All rights reserved.