Curriculum
Course: SQL
Login

Curriculum

SQL

SQL References

0/80

MySQL Functions

0/139

SQL Server Functions

0/84

SQL Quick Ref

0/1
Text lesson

ADD CONSTRAINT

ADD CONSTRAINT

The ADD CONSTRAINT command is used to add a constraint to an already existing table.

The SQL statement below adds a constraint named “PK_Person” that acts as a PRIMARY KEY constraint on multiple columns (ID and LastName).

Example

ALTER TABLE Persons
ADD CONSTRAINT PK_Person PRIMARY KEY (ID,LastName);