UNIQUE ALTER TABLE

UNIQUE constraint can be added to a column in a table, after being created by the ALTER TABLE.

Syntax UNIQUE ALTER TABLE

ALTER TABLE people ADD UNIQUE (id)

Create a unique constraint (unique value across the table) for column 'id'.

You can also create restrictions for multiple columns at once

ALTER TABLE people ADD CONSTRAINT copeople UNIQUE (id, surname)

To remove a restriction on the MySQL database

ALTER TABLE people DROP INDEX copeople

To remove a restriction on ORACLE, SQLSERVER and ACCESS

ALTER TABLE people DROP CONSTRAINT copeople