删除具有外键关联的两个表

来源:互联网 发布:mac战网删除游戏 编辑:程序博客网 时间:2024/05/18 06:27

先删除具有外键约束的表:

 

drop table child;

 

drop table parent;

 

 

--------------------------------------------

create table parent(id number(4) not null primary key,
name nvarchar2(20) not null);

---------------------------------------------------------

create table child(id number(4) not null primary key,
name nvarchar2(20) not null, parent_id not null);

--------------------------------------------------------

alter table child add constraint childfk
foreign key (parent_id) references parent;

 

原创粉丝点击