UNIQUE Constraints on Columns or Tables

The UNIQUE constraint specifies that one or more columns uniquely identify each row in the table.

UNIQUE is essentially the same as a PRIMARY KEY constraint, except that you can specify more than one UNIQUE constraint in a table. With both UNIQUE and PRIMARY KEY, columns cannot contain any NULL values.

Example 1

This example adds the column ss_number to the employee table, and ensures that each value in it is unique throughout the table:
ALTER TABLE employee 
ADD ss_number char(11) UNIQUE 

Example 2

In this example, three columns make a unique entry.
ALTER TABLE product
ADD UNIQUE (name, size, color)