Tuesday, May 1, 2007

Establishing primary key auto creates index

In MySQL, you can have a primary key constraint on one or more columns. Establishing a primary key causes MySQL to automatically make a unique key that consists of the columns specified in the primary key. You can verify the existence of this key by running the command:

SHOW INDEX FROM [table name];

In the resulting output, the column 'Non_unique' shows '0' if the column is unique, and '1' if the column is not unique.

No comments: