A KEY is a synonym for INDEX . You use KEY when you want to create an index for a column or a set of columns that is not the part of a primary key or unique key.
A UNIQUE index creates a constraint for a column whose values must be unique. Unlike the PRIMARY index, MySQL allows NULL values in the UNIQUE index. A table can also have multiple UNIQUE indexes.
For example, the email and username of user in the users table must be unique. You can define UNIQUE indexes for the email and username columns as the following statement:
Add a UNIQUE index for the username column.