mysql unique
snippet in sql

mysql set field unique

user4536

ALTER TABLE mytbl ADD UNIQUE (columnName);

mysql alter table set column unique

user6473

ALTER TABLE contacts
ADD CONSTRAINT contacts_unique UNIQUE (reference_number);

mysql unique

user988

-- SQL Server / Oracle / MS Access:
CREATE TABLE Persons (
    ID int NOT NULL UNIQUE,
    LastName varchar(255) NOT NULL,
    FirstName varchar(255),
    Age int
);

-- MySQL:
CREATE TABLE Persons (
    ID int NOT NULL,
    LastName varchar(255) NOT NULL,
    FirstName varchar(255),
    Age int,
    UNIQUE (ID)
);