Mega Code Archive

 
Categories / MySQL Tutorial / Table
 

Creating an Index with the ALTER TABLE Statement

mysql> mysql> CREATE TABLE myTable     -> (     ->    ID SMALLINT UNSIGNED NOT NULL PRIMARY KEY,     ->    Name VARCHAR(40) NOT NULL     -> ); Query OK, 0 rows affected (0.03 sec) mysql> mysql> alter table myTable add index(name); Query OK, 0 rows affected (0.05 sec) Records: 0  Duplicates: 0  Warnings: 0 mysql> mysql> drop table myTable; Query OK, 0 rows affected (0.00 sec)