奇怪的NULL

为什么建表时加not null default‘’或者default0

为什么不希望列的值不为null?

null是空,null的比较需要特殊的运算符    is null   is not null

select * from test where name is not null

取出不是null的值

 

select * from test where name is null

取出是null的值

 

null是空类型,比较时候只能用专门的is null 或者is not null 来比较

碰到其它运算符一律返回null,效率不高,影响搜索的效率

因此在建表的时候声明 not null default ‘’

posted @ 2013-11-23 22:08  long896130895  阅读(101)  评论(0)    收藏  举报