数据库中的空值显示为null,它是一种特殊的未知值,不属于任何一种数据类型,因此它和任何类型的数据进行运算,返回结果都为null。
在where子句中进行条件查询时,就需要使用is [not] null进行空值查询。
语法格式:
select <字段名列表> from <表名> where <字段名> is [not] null;
示例:
select * from stu where s_gender is null;
select * from stu where s_gender is not null;