English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Usage and Examples of SQL ADD CONSTRAINT Keyword

SQL Keyword Reference

ADD CONSTRAINT

The ADD CONSTRAINT command is used to create a constraint after the table is created.

The following SQL adds a constraint named 'PK_Person' on multiple columns (ID and LastName), which is a PRIMARY KEY constraint:

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

SQL Keyword Reference