mariadb root@localhost:dyw> insert into dcount(author,dcount) values('jenny',nul l),('sara',null); Query OK, 2 rows affected Time: 0.006s
=, !=
。
mysql> select * from dcount_tbl where dyw_count = null; mysql> select * from dcount_tbl where dyw_count != null;
IS NULL, IS NOT NULL
等語法。
mariadb root@localhost:dyw> select * from dcount where dcount is null; +--------+--------+ | author | dcount | +--------+--------+ | jenny | <null> | | sara | <null> | +--------+--------+ 2 rows in set Time: 0.025s mariadb root@localhost:dyw> select * from dcount where dcount is not null; +--------+--------+ | author | dcount | +--------+--------+ | dywang | 4 | | linda | 3 | | peter | 2 | | rita | 1 | +--------+--------+ 4 rows in set Time: 0.021s
<=>
運算子等效 IS NULL
語法。
mariadb root@localhost:dyw> select * from dcount where dcount <=> null; +--------+--------+ | author | dcount | +--------+--------+ | jenny | <null> | | sara | <null> | +--------+--------+ 2 rows in set Time: 0.021s