Now let's see the other possible definitions (for the entire table):
Code:
[CONSTRAINT [symbol]] PRIMARY KEY [type_index] (column_index ,...)
| KEY [index_name] [type_index] (column_index ,...)
| INDEX [index_name] [type_index] (column_index ,...)
| [CONSTRAINT [symbol]] UNIQUE [INDEX]
[Index_name] [type_index] (column_index ,...)
| [FULLTEXT | SPATIAL] [INDEX] [index_name] (column_index ,...)
| [CONSTRAINT [symbol]] FOREIGN KEY
[Index_name] (column_index ,...) [reference_definition]
These options allow you to define indexes or foreign keys. If you want to define an index on more than one column, the only way to do this is to define it in this part of the CREATE TABLE statement. Note that in this case is synonymous KEY INDEX, and when used on a column definition is synonymous with PRIMARY KEY. The name for the index is always PRIMARY KEY and for the other indexes, if not specified, will use the name of the first column that makes up the index (with possible adjustments to make unique names).
Bookmarks