怎么用sql语句删除外键?(不用约束名)

来源:百度知道 编辑:UC知道 时间:2024/06/19 03:43:36
怎么用sql语句删除外键?(不用约束名)

脚本:

create table books(
bookid char(20) primary key,
bookname char(50),
bookauthor char(30),
bookpublic char(30),
price number);

alter table books
add isbn varchar2(10);

alter table books
add foreign key (isbn) references readers(readerid);

然后怎么删除它呢?(不用约束名)
是Oracle 10g 数据库

alter table books add constrait 外健名--指定一下名
add foreign key (isbn) references readers(readerid);
alter table books drop constraint 外健名

alter table books drop column isbn;
alter table add isbn char(20);
如果是你刚刚执行完这条语句想删除的话直接ROLLBACK