MySQL的主键,索引设置和添加
PRI primary key 表示主键,唯一 写法: id bigint(20) unsigned primary key not null ,
uni UNIQUE 表示唯一 写法 id bigint(20) unsigned UNIQUE default NULL
mul 添加了索引 写法: alter table test add index suoyin (col_name1);
如果有同时存在,
显示顺序 PRI>UNI>MUL
添加索引:
假设有数据库表playlist163,将其中的over字段里key 设为MUL
mysql>alter table playlist163 add index(over);