Mega Code Archive

 
Categories / MySQL / Key
 

A primary key on a column can be created by replacing PRIMARY KEY with UNIQUE in the table definition, provide

d that the column is declared NOT NULL: mysql> mysql> CREATE TABLE t     -> (     ->     id   INT NOT NULL,     ->     name CHAR(30) NOT NULL,     ->     UNIQUE (id)     -> ); Query OK, 0 rows affected (0.00 sec)