SQL- unique constraint :

Unique constraint is used to ensure that the values in the columns are distinct are not.It provides a guarantee for uniqueness in a column or set of columns.
UNIQUE and PRIMARY KEY constraints both provide a guarantee for uniqueness for a column or set of columns.
A PRIMARY KEY constraint automatically has a UNIQUE constraint defined on it.


SYNTAX :
UPDATE table_name
SET column1=value, column2=value2,...
WHERE some_column=some_value

Must Read:

You can have many UNIQUE constraints per table, but only one PRIMARY KEY constraint per table.



Syntax -> set Unique KEY constraint on CREATE TABLE :

MySQL:

CREATE TABLE table_name
(column1 datatype,
column2 datatype,
.....,
UNIQUE(column1)
);


SQL Server / Oracle / MS Access:

CREATE TABLE table_name
(column1 datatype UNIQUE,
column2 datatype,
.....
);



Online Execute/Compile

Quantitative Aptitude
Reasoning
Programming
Interview