Use both Tuple Relational Calculus (TRC) and Domain Relational Calculus (DRC) to
ID: 3591636 • Letter: U
Question
Use both Tuple Relational Calculus (TRC) and Domain Relational Calculus (DRC) to express 9,10,11,12 and and query results just for 11 and 12
Suppliers S# SNAME STATUS CITY | si Smith | 20 London S2 Jones 30 Paris S3 Blake | 30 Paris S4| Clark 20 London S5 Adams 30 Athens SP S#P# QTY S1P1300 S1 | P2200 S1 | P3400 S1 P4200 S1 | P5100 SI | P6100 S2 P1300 S2 | P2 P2400 S3 | P1300 S3 | P2200 Parts P# PNAME COLOR WEIGHT CITY ' P1Nut Red 12.0 London P2 Bolt || Green 17.0 | Paris P3 Screw Blue 17.0 Oslo P4 Screw Red 14.0 London Ps Cam Blue 12.0 Paris P6 Cog Red 19.0 London S4 P2200 S4 P3300 Il S4 P4400 S4 P5500 S4 | P6600Explanation / Answer
8)
select distinct sup.sname
from sup
where NOT EXISTS
(select *
from p
where NOT EXISTS
(select *
from sp
where sp.s# = s.s#
and sp.p# = p.p#) );
SNAME
------
Smith
----------------------------------------------------------------------------------------------
9)
select distinct sup.sname , count(p#), spp.qty
from sup
where sup.s#
(select spp.s#
from spp
where spp.p# = sup.s# );
--------------------------------------------------------------------------------------------------------
10)
select distinct sp.pno,sname sp.qty from
supplier inner join sp using (sno);
--------------------------------------------------------------------------------------------------------------
11)
select distinct s.s# , s.sname
from s, sp
where s.s# = sp.s# and p# IN
(select p#
from sp
where sp.s# = 'S2')
--------------------------------------------------------------------------------------------------------
12)
select distinct s.s# , s.sname
from s, sp
where s.s# = sp.s# and p#
(select p#
from sp
where sp.s# = 'S2')
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.