How to include a unique index in the table definition.
mysql>
mysql> CREATE TABLE Orders
-> (
-> OrderID SMALLINT UNSIGNED NOT NULL,
-> ModelID SMALLINT UNSIGNED NOT NULL,
-> ModelDescrip VARCHAR(40),
-> PRIMARY KEY (OrderID),
-> UNIQUE (OrderID, ModelID)
-> );
Query OK, 0 rows affected (0.00 sec)
mysql>
mysql> drop table Orders;
Query OK, 0 rows affected (0.00 sec)
Related examples in the same category