Foreign key - Restrict/Cascade/..

Delete/Update 시 옵션
- Restrict
- Delete/Update 시 FK가 다른 Raw 참조 시 Update/Delete 불가
- Cascade
- Delete/Update 시 FK가 다른 Raw도 같이 Update/Delete
- No Action
- Restrict와 동일
- Set Null
- 참조하고 있는 값은 Null로 세팅
- Set default
- 참조하고 있는 값을 Default 값으로
1
2
3
4
5
6
7
CREATE TABLE Test
(
ID INT,
ParentID INT,
FOREIGN KEY (ParentID)
REFERENCES Test1(ID) ON UPDATE CASCADE ON DELETE RESTRICT
);