English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The DROP CONSTRAINT command is used to delete UNIQUE, PRIMARY KEY, FOREIGN KEY, or CHECK constraints.
To delete the UNIQUE constraint, please use the following SQL:
SQL Server / Oracle / MS Access:
ALTER TABLE Persons DROP CONSTRAINT UC_Person;
MySQL:
ALTER TABLE Persons DROP INDEX UC_Person;
To delete the PRIMARY KEY constraint, please use the following SQL:
SQL Server / Oracle / MS Access:
ALTER TABLE Persons DROP CONSTRAINT PK_Person;
MySQL:
ALTER TABLE Persons DROP PRIMARY KEY;
To delete a FOREIGN KEY constraint, use the following SQL:
SQL Server / Oracle / MS Access:
ALTER TABLE Orders DROP CONSTRAINT FK_PersonOrder;
MySQL:
ALTER TABLE Orders DROP FOREIGN KEY FK_PersonOrder;
To delete a CHECK constraint, use the following SQL:
SQL Server / Oracle / MS Access:
ALTER TABLE Persons DROP CONSTRAINT CHK_PersonAge;
MySQL:
ALTER TABLE Persons DROP CHECK CHK_PersonAge;