You can add an index on a column that can have NULL values if you are using the MyISAM, InnoDB, or MEMORY storage engine.

w

https://dev.mysql.com/doc/refman/5.7/en/create-index.html

MySQL :: MySQL 5.7 Reference Manual :: B.5.4.3 Problems with NULL Values
https://dev.mysql.com/doc/refman/5.7/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.

MySQL :: MySQL 5.7 Reference Manual :: 14.1.14 CREATE INDEX Syntax
https://dev.mysql.com/doc/refman/5.7/en/create-index.html

The MyISAMInnoDBNDB, and ARCHIVE storage engines support spatial columns such as (POINT and GEOMETRY. (Section 12.5, “Extensions for Spatial Data”, describes the spatial data types.) However, support for spatial column indexing varies among engines. Spatial and nonspatial indexes are available according to the following rules.

Spatial indexes (created using SPATIAL INDEX) have these characteristics:

  • Available only for MyISAM and InnoDB tables. Specifying SPATIAL INDEX for other storage engines results in an error.
  • Indexed columns must be NOT NULL.
  • Column prefix lengths are prohibited. The full width of each column is indexed.

Characteristics of nonspatial indexes (created with INDEXUNIQUE, or PRIMARY KEY):

  • Permitted for any storage engine that supports spatial columns except ARCHIVE.
  • Columns can be NULL unless the index is a primary key.
  • For each spatial column in a non-SPATIAL index except POINT columns, a column prefix length must be specified. (This is the same requirement as for indexed BLOB columns.) The prefix length is given in bytes.
  • The index type for a non-SPATIAL index depends on the storage engine. Currently, B-tree is used.
  • You can add an index on a column that can have NULL values only for InnoDBMyISAM, and MEMORY tables.
  • You can add an index on a BLOB or TEXT column only for using the InnoDB and MyISAM tables.
  • When the innodb_stats_persistent setting is enabled, run the ANALYZE TABLE statement for an InnoDB table after creating an index on that table.
时间: 2024-10-05 22:21:19

You can add an index on a column that can have NULL values if you are using the MyISAM, InnoDB, or MEMORY storage engine.的相关文章

eclips git中的add to Index无效解决

今天在使用eclips git中的add to Index,发现其无效,具体如下 问题描述: 通过export导入一个git java项目 在java工程中新增一个类文件IndicatorCalcTest.java 在eclips中选择该文件,team->add to Index,操作后该文件未显示+号 问题定位: 直接通过命令行进入IndicatorCalcTest.java文件所在目录,命令执行git add IndicatorCalcTest.java,报如下错误 C:\Users\Adm

Java ArrayList add(int index, E element) example

Simple add() method is used for adding an element at the end of the list however there is another variant of add method which is used for adding an element to the specified index. public void add(int index, Object element) This method adds the elemen

com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException: Column 'goodsName' cannot be null

com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException: Column 'goodsName' cannot be null 出现这错误,是我封装页面的时候出现的错误. private void addGoods(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // 1.

hibernate报错:Column 'id' cannot be null

报错内容: 17:21:59,843  INFO org.hibernate.tool.hbm2ddl.SchemaExport:226 - Running hbm2ddl schema export 17:21:59,859 DEBUG org.hibernate.tool.hbm2ddl.SchemaExport:242 - import file not found: /import.sql 17:21:59,859  INFO org.hibernate.tool.hbm2ddl.Sch

错误代码: 1048 Column 'typeId' cannot be null

1.错误描述 1 queries executed, 0 success, 1 errors, 0 warnings 查询:CALL analyse_con('2015-01-01 00:00:00','2016-01-01 00:00:00') 错误代码: 1048 Column 'typeId' cannot be null 执行耗时 : 0 sec 传送时间 : 0 sec 总耗时 : 0.015 sec 2.错误原因 typeId字段为int(8),并且不为空,但是插入数据时有null,

Error updating database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Column 'username' cannot be null

今天程序中遇见这个错误一直找不到哪里错后来重写了一遍jsp页面才知道 username我写成了name 和po中的代码对应不上导致了这个错误 写代码一定要认真一点啊     好坑啊 Error updating database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Column 'username' cannot be null

select 下拉菜单Option对象使用add(elements,index)方法动态添加

原生js 的add函数为下拉菜单增加选项 1.object.add(oElement [, iIndex]) index 可选参数:指定元素放置所在的索引号,整形值.如果没有指定值,将添加到集合的最后. 想加到最前面,指定索引值0就可以了. @@注意: add方法为js原生方法,属于element元素对象,在使用jquery对象获取元素时是不可用的 var select = $('#select'); select.add(new Option(txt,val)) 提示:undefined ad

添加一个index(add an index)

想ES中存储数据,需要index--存储数据的地方,实际上,index就是一个指向若干物理shard的逻辑命名空间. shard就是更底层的工作单元,每个shard是一个Lucene的实例,每个shard在其控制范围内都是一个完整的搜索引擎.我们的文档被存储,并且被index到shard,但是应用程序是不和shard直接对话的而是和index进行通信. 由于shard是真正储存数据的地方,因此shard表示了ES在你的cluster中是怎么分布数据的.文档被存储在shard中,shard被分配到

Mapping is missing column attribute for property null错误

你的映射文件格式有问题,对于<property>元素,不需要<column>子元素,你只要把<column>元素都删除就可以了 <id column="id" property="id" jdbcType="INTEGER" /> <result column="name" property="name" jdbcType="VARCHAR&q