显示表中多有的索引show all index
添加索引add index, 添加唯一索引add unique index
多列联合添加索引,primary key
关键词index vs key
show all indexshow index from tb_name 例如:
show index from springdemo.blog;
添加索引add index, 添加唯一索引add unique indexalter table `table` add index `product_id` (`product_id`) # 创建唯一索引alter table tb_name add unique index `unique_idsrc_caffeversion` (`id_src`, `caffe_version`)
多列联合索引,添加主键#多列索引alter table `table` add index `index_name` (`col1`,`col2`) # add primary key 添加主键alter table `table_name` add primary key ( `column` )
关键词index vs key在创建表的时候,这两个关键词没什么区别,相当于同义词
what are differences between index v.s. key in mysql
create table tasks ( task_id int unsigned not null auto_increment, index parent (parent_id), ....# however i found a code using key instead of index as following....key order_date (order_date) ...
there’s no difference. they are synonyms.this was implemented for compatibility with other database systems.
以上就是mysql索引index相关命令的详细介绍的详细内容。
