设定dept表deptno列为主键。
alter
table
dept
add
constraint
pk_deptno
primary
key
(deptno);
在emp表deptno列上建立外键引用dept表deptno,指定外键类型为级联删除。
alter
table
emp
add
constraint
fk_deptno
foreign
key
(deptno)
references
dept(deptno)
on
delete
cascade;
这样删除dept表
只需:delete
from
dept
where
city='shanghai';
就可以自动删除对应emp表内容。
update
A
set
A.E=B.H
where
A.G
in(select
B.G
from
B)
楼主,我一直用的就是oracle数据库啊
,可能不是语句错误,搞不好是主键的问题啊,A,B表的主键就一个且是G吗?
这样试试看呢