mysql 是否是空字符串或者null判断
获取字段field为非空值的数据,语法:【select * from tableName where field is not null】获取字段field为空值的数据,语法:【select * from tableName where field is null】获取字段field为空字符串的数据,语法:【select * from tableName where field=”】获取字段fie
·
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!=”】
更多推荐
已为社区贡献1条内容
所有评论(0)