What is UNIQUE Constraint in SQL

The UNIQUE constraint uniquely identifies each row in a table. The restriction which unique enforces in the Uniqueness of values with respect to any column.

The UNIQUE and PRIMARY KEY constraints both provide a guarantee for uniqueness for a column or set of columns.

UNIQUE Constraint
UNIQUE Constraint

A PRIMARY KEY automatically has a UNIQUE key defined on it. Note that you can have many UNIQUE per tables, but only one PRIMARY KEY per table.

CREATE TABLE Persontable
(
P_Id int UNIQUE,
LastName varchar(255) NOT NULL,
FirstName varchar(255),
Address varchar(255),
City varchar(255)
)

More Articles:-

What are the different Oracle versions?

Top 10 Insurance Companies in India

If you have any query on database management system then comment your questions

Thank you

Leave a Reply

Your email address will not be published. Required fields are marked *