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

怎么用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 外健名
温馨提示:答案为网友推荐,仅供参考
第1个回答  2009-05-06
alter table books drop column isbn;
alter table add isbn char(20);
如果是你刚刚执行完这条语句想删除的话直接ROLLBACK
第2个回答  2019-01-18
外键属于外键约束,使用删除外键约束
alter
table
表名
drop
constraint
约束名