浩晨众云网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
本篇文章给大家分享的是有关Mysql NULL,小编觉得挺实用的,因此分享给大家学习,希望大家阅读完这篇文章后可以有所收获,话不多说,跟着小编一起来看看吧。
比较运算符中使用NULL
mysql> select 1>NULL; +--------+ | 1>NULL | +--------+ | NULL | +--------+ 1 row in set (0.00 sec) mysql> select 1select 1<>NULL; +---------+ | 1<>NULL | +---------+ | NULL | +---------+ 1 row in set (0.00 sec) mysql> select 1>NULL; +--------+ | 1>NULL | +--------+ | NULL | +--------+ 1 row in set (0.00 sec) mysql> select 1 select 1>=NULL; +---------+ | 1>=NULL | +---------+ | NULL | +---------+ 1 row in set (0.00 sec) mysql> select 1<=NULL; +---------+ | 1<=NULL | +---------+ | NULL | +---------+ 1 row in set (0.00 sec) mysql> select 1!=NULL; +---------+ | 1!=NULL | +---------+ | NULL | +---------+ 1 row in set (0.00 sec) mysql> select 1<>NULL; +---------+ | 1<>NULL | +---------+ | NULL | +---------+ 1 row in set (0.00 sec) mysql> select NULL=NULL,NULL!=NULL; +-----------+------------+ | NULL=NULL | NULL!=NULL | +-----------+------------+ | NULL | NULL | +-----------+------------+ 1 row in set (0.00 sec) mysql> select 1 in (null),1 not in (null),null in (null),null not in (null); +-------------+-----------------+----------------+--------------------+ | 1 in (null) | 1 not in (null) | null in (null) | null not in (null) | +-------------+-----------------+----------------+--------------------+ | NULL | NULL | NULL | NULL | +-------------+-----------------+----------------+--------------------+ 1 row in set (0.00 sec) mysql> select 1=any(select null),null=any(select null); +--------------------+-----------------------+ | 1=any(select null) | null=any(select null) | +--------------------+-----------------------+ | NULL | NULL | +--------------------+-----------------------+ 1 row in set (0.00 sec) mysql> select 1=all(select null),null=all(select null); +--------------------+-----------------------+ | 1=all(select null) | null=all(select null) | +--------------------+-----------------------+ | NULL | NULL | +--------------------+-----------------------+ 1 row in set (0.00 sec)