設置外鍵約束的SQL語句:

格式:alter table 須要創建外鍵的表 add constraint 外鍵名字 foreign key(外鍵字段)  references 外鍵表(被別的表引爲外鍵的字段)  例子:  班級和學生是一對多的關係,將班級表(class)中的主鍵(class_id)做爲學生表(student)的外鍵對學生表進行約束。  alter table student  add constraint f
相關文章
相關標籤/搜索