看啥推荐读物
专栏名称: Java知音
专注于Java,推送技术文章,热门开源项目等。致力打造一个有实用,有情怀的Java技术公众号!
今天看啥  ›  专栏  ›  Java知音

为什么MySQL不建议使用NULL作为列默认值?

Java知音  · 公众号  ·  · 2021-02-15 17:05
译者:guangsu.blog.csdn.net/qq_30549099/article/details/107395521通常能听到的答案是使用了NULL值的列将会使索引失效,但是如果实际测试过一下,你就知道IS NULL会使用索引.所以上述说法有漏洞.着急的人拉到最下边看结论PrefaceNull is a special constraint of columns.The columns in table will be added null constrain if you do not define the column with “not null” key words explicitlywhen creating the table.Many programmers like to define columns by defaultbecause of the conveniences(reducing the judgement code of nullibility) what consequentlycause some uncertainty of query and poor performance of database.NULL值是一种对列的特殊约束,我们创建一个新列时,如果没有明确的使用关键字not null声明该数据列,Mysql会默认的为我们添加上NULL约束.有些开发人员在创建数据表时,由于懒 ………………………………

原文地址:访问原文地址
快照地址: 访问文章快照