9Algorithm
9Algorithm

Reputation: 1257

How to create an index based on 2 columns using the UNIQUE keyword in MySQL?

I know how to make it like this:

ALTER TABLE birdwatchers.humans
ADD INDEX human_names (name_last, name_first);

But how to do the same thing using the UNIQUE keyword (my book asks me for that)?

Upvotes: 0

Views: 19

Answers (1)

Spade
Spade

Reputation: 2280

You can use add unique:

Alter table birdwatchers.humans add unique human_names(name_last, name_first);

Upvotes: 2

Related Questions