标签:select 数据 ble com mysq 数据表 count where mysql
在创建数据表过程中,有的数据字段要设置数据值,可以默认值,可以为空 null ,当时在查询语句对字段不起作用,那么mysql使用什么关键词呢,IS NULL,IS NOT NULL,下面细说其用法。
1,创建数据表
create table dc3688_test_tbl
-> (
-> dc3688_author varchar(40) NOT NULL,
-> dc3688_count INT
-> );
2,查询不起作用
mysql> SELECT * FROM dc3688_test_tbl WHERE dc3688_count = NULL;
Empty set (0.00 sec)
mysql> SELECT * FROM dc3688_test_tbl WHERE dc3688_count != NULL;
Empty set (0.01 sec)
3,用IS NULL,IS NOT NULL
SELECT * FROM dc3688_test_tbl WHERE runoob_count IS NULL
SELECT * from dc3688_test_tbl WHERE runoob_count IS NOT NULL
4,php处理null
使用关键词 isset($count )
文章来自 http://www.dc3688.com/
标签:select 数据 ble com mysq 数据表 count where mysql
原文地址:http://blog.51cto.com/13959155/2179003