ADD CONSTRAINT Keyword
The ADD CONSTRAINT keyword or command is used to add a constraint to an existing column.
We create a table and then realise that we have forgotten to add constraint in a specific column then Add Constraint Commnad is used.
The ADD CONSTRAINT is a combination of two keywords ADD and CONSTRAINT. they both are different keywords.
But whenever we have to create a constraint to an existing column we use ADD CONSTRAINT keyword.
Syntax
ALTER TABLE <TABLE_NAME>
ADD CONSTRAINT <CONSTRAINT_NAME> <SPECIFIC_CONTRAINT> (<COLUMN_NAME1>,<COLUMN_NAME2>);Example 1
ALTER TABLE Employee ADD CONSTRAINT UniqueName UNIQUE(Emp_Name);Example 2
ALTER TABLE Employee
ADD CONSTRAINT MainPrimary PRIMARY KEY (Emp_ID);Example 3
ALTER TABLE Employee
ADD CONSTRAINT CheckAge CHECK (Emp_Age < 55);Summary
ADD CONSTRAINT is used to create a constraint after a table is already created.

Join the conversation! Your thoughts help the community grow.