1、空值与空字符串不同,判断方法也不同

判断NULL用is null 或者 is not null。
判断空字符串,要用 =”或者 <>”。
2、用法说明

获取空值或非空值的数据:

获取字段field为空值的数据,语法:【select * from tableName where field is null】
获取字段field为非空值的数据,语法:【select * from tableName where field is not null】
获取空字符串或非空字符串的数据:

获取字段field为空字符串的数据,语法:【select * from tableName where field=”】
获取字段field为非空字符串的数据,语法:【select * from tableName where
field!=”】

Logo

更多推荐