Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 1

Muhammad Ali Azeemi

15109

1) select j.jname, p.pname from p,j,spj where spj.j# = j.j#


And spj.p# = p.p# and spj.p# in
(select p# from p where rownum < 3
Order by weight desc)
group by spj.p#, j.name, p.pname;

2) select rownum, tst.sname from


( select rownum, * from s
where rownum <=10
order by sname
) tst;

3) select j#, count(p#) from spj


group by j#
having count(p#) > 5;

4) select spj.j# from spj, j, s


where spj.s# = s.s#
and spj.j#=j.j#
and s.city <> j.city;

5) select j# from j where city like ‘_o%’;

6) select j# from j where


( select avg(qty) from spj
where j#.j.j#
and p# = ‘p1’
)
>
(
select max(qty) from spj where j#=’j1’
);

7) select distinct spj.j# from spj


where (s#, p#) not in (
select s#, p# from s,p where
s.city=’london’ and p.color=’red’
);

8) select s# from s where exists


(select * from p where not exists (
(select * from spj where spj.j# = j.j#
and spj.p# = p.p#
and spj.s# = s.s# )));

You might also like