Mega Code Archive

 
Categories / MySQL / Table Index
 

Create a single-column index on c, and the second creates a multiple-column index that includes both c and i

mysql> mysql> CREATE TABLE mytbl     -> (     ->     i INT,     ->     c CHAR(1)     -> ); Query OK, 0 rows affected (0.01 sec) mysql> mysql> ALTER TABLE mytbl ADD INDEX (c); Query OK, 0 rows affected (0.02 sec) Records: 0  Duplicates: 0  Warnings: 0 mysql> ALTER TABLE mytbl ADD INDEX (c,i); Query OK, 0 rows affected (0.01 sec) Records: 0  Duplicates: 0  Warnings: 0 mysql> mysql> drop table mytbl; Query OK, 0 rows affected (0.00 sec)