




















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





















select dept, cat, count(*), avg(sal)/ from emp group by dept, cat
note that some dname/cat groups are empty.
select dname, avg(sal) from emp where age<30 (employee age under 30) group by dname (group by department) having 10<count(*) (group size > 10)
select cat, avg(sal) from emp group by cat having avg(sal)> (select avg(sal) from emp where cat=“programmer”)
select dname from emp where job=“clerk” group by dname having count(*) >= 2
select bid, bname, count(s.sid) from sailors s, boats b, reserve r where s.sid=r.sid and r.bid=b.bid and rating> group by b.bid
select bid, bname, count(s.sid) from sailors s, boats b, reserve r where s.sid=r.sid and r.bid=b.bid group by b.bid having colour=“red”
t: is a tuple variable ranging over the relation R t[A]: is the value of attribute A in tuple t
{<ss#, course#, semester> | Enroll(ss#, course#, semester)}
{<x, y, z> | Enroll(x, y, z)? y = CMSC-424}