赞
踩
- -- 添加外键
- alter table emp
- add constraint fk_emp_dept_id foreign key (dept_id) references dept (id);
-
- -- 删除外键
- alter table emp
- drop constraint fk_emp_dept_id;
-
- -- 外键的删除和更新行为 cascade
- alter table emp
- add constraint fk_emp_dept_id foreign key (dept_id) references dept (id) on update cascade on delete cascade;
-
- -- set null
- alter table emp
- add constraint fk_emp_dept_id foreign key (dept_id) references dept (id) on update set null on delete set null;
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。