SQL FOREIGN KEY Constraint on ALTER TABLE

- ์™ธ๋ž˜ํ‚ค ์ถ”๊ฐ€ํ•˜๊ธฐ

MySQL / SQL Server / Oracle / MS Access:

ALTER TABLE Orders
ADD FOREIGN KEY (P_Id)
REFERENCES Persons(P_Id)


- ์™ธ๋ž˜ํ‚ค ์ด๋ฆ„ ์ง€์ •ํ•ด์ฃผ๊ธฐ

MySQL / SQL Server / Oracle / MS Access:

ALTER TABLE Orders
ADD CONSTRAINT fk_PerOrders
FOREIGN KEY (P_Id)
REFERENCES Persons(P_Id)


To DROP a FOREIGN KEY Constraint

- ์™ธ๋ž˜ํ‚ค ์‚ญ์ œํ•˜๊ธฐ 


MySQL:

ALTER TABLE Orders
DROP FOREIGN KEY fk_PerOrders

SQL Server / Oracle / MS Access:

ALTER TABLE Orders
DROP CONSTRAINT fk_PerOrders