Tuesday, 30 May 2023

How to add unique constraint in mysql

UNIQUE Constraint on ALTER TABLE

To create a UNIQUE constraint on the "ID" column when the table is already created, use the following SQL:

ALTER TABLE Persons
ADD UNIQUE (ID);

Source : https://www.w3schools.com/mysql/mysql_unique.asp 

No comments:

Post a Comment