SQL FOREIGN KEY Constraint

Published on by LakshmiSaahul,Dhana Royal

SQL FOREIGN KEY Constraint

A FOREIGN KEY in one table points to a PRIMARY KEY in another table.

CREATE TABLE Orders
(
O_Id int NOT NULL PRIMARY KEY,
OrderNo int NOT NULL,
P_Id int FOREIGN KEY REFERENCES Persons(P_Id)
)

To DROP a FOREIGN KEY Constraint

ALTER TABLE Orders
DROP CONSTRAINT fk_PerOrders

Advertising
To be informed of the latest articles, subscribe:
Comment on this post