首页 > 数据库技术 > 详细

mysql中的NULL的判断

时间:2015-09-03 14:01:49      阅读:288      评论:0      收藏:0      [点我收藏+]
 
mysql> delete from `zhangchao` where x=NULL;
Query OK, 0 rows affected (0.00 sec)

mysql> delete from `zhangchao` where x=NULL; 
Query OK, 0 rows affected (0.00 sec)

mysql> select * from zhangchao;
+------+-------+
| x    | y     |
+------+-------+
| xxx  | yyy   |
| NULL | NULL  |
| xxx  | james |
| xxx  | lucy  |
| xxx  | alex  |
+------+-------+
5 rows in set (0.00 sec)

mysql> delete from `zhangchao` where x  is null;
Query OK, 1 row affected (0.00 sec)

mysql> select * from zhangchao;
+------+-------+
| x    | y     |
+------+-------+
| xxx  | yyy   |
| xxx  | james |
| xxx  | lucy  |
| xxx  | alex  |
+------+-------+
4 rows in set (0.00 sec)

mysql>

需要使用is null来进行判断。

mysql中的NULL的判断

原文:http://www.cnblogs.com/justinzhang/p/4780102.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!