The DROP CONSTRAINT
command is used to delete a UNIQUE, PRIMARY KEY, FOREIGN KEY, or CHECK constraint.
To drop a UNIQUE constraint, 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 drop a PRIMARY KEY constraint, use the following SQL:
SQL Server / Oracle / MS Access:
ALTER TABLE Persons
DROP CONSTRAINT PK_Person;
MySQL:
ALTER TABLE Persons
DROP PRIMARY KEY;
To drop 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 drop 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;
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!