The syntax for CREATE INDEX is as follows
mysql>
mysql> CREATE TABLE HeadOfState
-> (
-> ID INT NOT NULL,
-> LastName CHAR(30) NOT NULL,
-> FirstName CHAR(30) NOT NULL,
-> CountryCode CHAR(3) NOT NULL,
-> Inauguration DATE NOT NULL
-> );
Query OK, 0 rows affected (0.01 sec)
mysql>
mysql>
mysql> CREATE UNIQUE INDEX IDIndex ON HeadOfState (ID);
Query OK, 0 rows affected (0.01 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql>
mysql> CREATE INDEX NameIndex ON HeadOfState (LastName,FirstName);
Query OK, 0 rows affected (0.01 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql>
mysql> drop table HeadOfState;
Query OK, 0 rows affected (0.00 sec)
Related examples in the same category