关系代数中的除法运算对应的SQL语句怎么写
请问关系代数中的除法运算对应的SQL语句怎么写
比如两个表 A(姓名,银行名,存款号) B(银行名)
查询在所有银行都存过款的人的姓名
问题点数:20、回复次数:5Top
1 楼wgsasd311(自强不息)回复于 2005-11-15 08:45:12 得分 0
比如两个表 A(姓名,银行名,存款号) B(银行名)
查询在所有银行都存过款的人的姓名
========>select 姓名 from A t where not exists
(select 1 from B where not exists(select 1 from B ,A where b.银行=a.银行 and a.姓名=t.姓名))Top
2 楼duanzilin(寻)回复于 2005-11-15 11:45:14 得分 0
select a.姓名 from a,b
where a.银行名(+) = b.银行名
group by a.姓名 having count(distinct a.银行名) = count(distinct b.银行名)Top
3 楼xjqqxjqq(JAI)回复于 2005-11-15 12:29:28 得分 0
同意楼上的Top
4 楼zzwind5(★★★★★)回复于 2005-11-15 12:39:54 得分 0
select 姓名 from A t where not exists
(select 1 from B where not exists(select 1 from A t2 where b.银行=t1.银行 and t.姓名=t1.姓名))Top
5 楼wgsasd311(自强不息)回复于 2005-11-15 19:31:34 得分 20
select 姓名 from A t where not exists
(select 1 from B where not exists(select 1 from A where 银行=b.银行 and 姓名=t.姓名))
Top




