MySQL Forums
Forum List  »  Newbie

Creating unique indexes
Posted by: Mika Salonen
Date: August 24, 2017 04:36PM

I have a table:

CREATE TABLE types
(
id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT
, info VARCHAR(128) NOT NULL
, name VARCHAR(32) NOT NULL

, PRIMARY KEY (id)

, UNIQUE INDEX (info, name)
) ENGINE=InnoDB CHARACTER SET latin1 COLLATE latin1_swedish_ci;

If I want to have an unique index, should I add the following code?

CREATE UNIQUE INDEX types_unique_index
ON types (info, name);

Options: ReplyQuote


Subject
Written By
Posted
Creating unique indexes
August 24, 2017 04:36PM
August 24, 2017 07:52PM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.