mysql null 和索引

在mysql中如果要在有null值的列上创建索引,存储引擎必须使用MyISAMInnoDB, 或者 MEMORY。如果不是这三种中的一个,那么被索引的列必须是not null;

 

官方文档:https://dev.mysql.com/doc/refman/5.5/en/problems-with-null.html

You can add an index on a column that can have NULL values if you are using the MyISAMInnoDB, or MEMORY storage engine. Otherwise, you must declare an indexed column NOT NULL, and you cannot insert NULL into the column.

posted on 2018-03-14 18:54  走一趟再说  阅读(429)  评论(0编辑  收藏  举报

导航