空值跟null的区别.mysql官方: “NULL columns require additional space in the row to record whether their values are NULL. For MyISAM tables, each NULL column takes one bit extra, rounded up to the nearest byte.” Mysql难以优化引用可空列查询,它会使索引.索引统计和值更加复杂.可空列需要更多的存储空间(见上…
相信很多用了mysql很久的人,对这两个字段属性的概念还不是很清楚,一般会有以下疑问: 1.我字段类型是not null,为什么我可以插入空值 2.为毛not null的效率比null高 3.判断字段不为空的时候,到底要 select * from table where column <> '' 还是要用 select * from table where column is not null 呢. 带着上面几个疑问,我们来深入研究一下null 和 not null 到底有什么不一样.…
相信很多用了mysql很久的人,对这两个字段属性的概念还不是很清楚,一般会有以下疑问: 我字段类型是not null,为什么我可以插入空值 为毛not null的效率比null高 判断字段不为空的时候,到底要 select * from table where column <> '' 还是要用 select * from table where column is not null 呢. 带着上面几个疑问,我们来深入研究一下null 和 not null 到底有什么不一样. 首先,我们要搞清…