请用关系代数表示下列查询语句F(drinker,bar)S(bar,beer)L(drinker,beer
1select *,*r,* from f as a,s as b,l as c where *=* and *r=*r group by *,*r,* having max(count(*))[原理,将三个关系表联系起来,分组统计出酒吧,人,啤酒的统计信息,在找出最大行数的列]2select bar from s where not beer=’青岛啤酒’3select drinker from f where drinker not in (select *r from f as a,s as b where *=* and *=’雪花啤酒’)[原理:查询出去了提供雪花啤酒的酒家的人,再not in排除掉]4select *r,* from f as a,s as b where *=* where *=’青岛啤酒’ group by *r,* having Count(*)>1。
一条查询语句
select partName ,isnull(sum((case when blankNum=1 then 1 end)),0) as ‘count(blankNum=1)’, isnull(sum((case when blankNum=2 then 1 end)),0) as ‘count(blankNum=2)’,isnull(sum((case when blankNum=3 then 1 end)),0) as ‘count(blankNum=3)’ from partList a , blankList b where *=* and *ID=4 and *pe=4 and group by partName测试下吧,应该是能满足你的需求的。