MySQL Key值(PRI, UNI, MUL)的含义
PRI主键约束;
UNI唯一约束;
MUL可以重复。
给age添加索引
create index ind_age on users(age);
mysql> desc testyy;
+-------------+--------------+------+-----+-------------------+----------------------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+--------------+------+-----+-------------------+----------------------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| username | varchar(50) | NO | MUL | NULL | |
| age | int(11) | YES | MUL | 0 |