mysql where中如何判断不为空_yemenlinweihan的博客_mysql 不为空
Data:
2016-08-26 07:25:16Form:
JournalClick:
9
mysql是开源免费的关系型数据库,由于其是免费的,所以使用也是比较广泛的。
mysql数据库的空分为两种:Null、空字符串
本文将针对这些空演示如何判断是否为空,以及如何写sql过滤,包括使用判空函数
方法/步骤
在数据库test的表table1中插入测试记录,包括空字符串、空对象的记录

查询 空对象(NULL) 记录,演示如下

查询 非空对象(NOT NULL)记录,演示如下

查询 空字符串 记录,演示如下

查询 非空字符串 记录,演示如下

查询空字符串、空对象的记录(使用ifnull()函数)

查询不是空字符串、不是空对象的记录(使用ifnull()函数)
