设有两个基本表R(A,B,C)和S(A,B,C)试用SQL查询语句表达下列关系代数表达式:

设有两个基本表R(A,B,C)和S(A,B,C)试用SQL查询语句表达下列关系代数表达式: (1)R∪S (2)R∩S (3)R-S

第1个回答  2011-11-13
楼上请自重,一楼的方法也不对
比较完美的方法是这样的
R∪S :select r.* from r
union select s.* from r, s
where r.a<>s.a or r.b<>s.b or r.c<>s.c/*<>就是!=*/

R∩S:select r.* from r,s
where r.a=s.a and r.b=s.b and r.c=s.c

R-S: select a,b,c from r
where not exists
(select a,b,c from s
where r.a=s.a and r.b=s.b and r.c=s.c)
第2个回答  2011-11-13
R∪S : select * from R union S
R∩S: select * from R intersect S
R-S: select * from R except S本回答被提问者采纳
相似回答