how to add unique constraint in mysql table
snippet in sql

mysql unique

user947

-- 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)
); 

how to add unique constraint in mysql table

user1661

ALTER TABLE mytbl ADD UNIQUE (columnName);