POSSIBLE HELPER BELOW: - MAY OR MAY NOT NEED Section 2: This section covers rela
ID: 3906473 • Letter: P
Question
POSSIBLE HELPER BELOW: - MAY OR MAY NOT NEED
Section 2: This section covers relational algebra (50 points). (A) Consider the following schema: Suppliers(sid: integer, sname: varchar(20), address: varchar(50)) Parts(pid: integer, pname: varchar(20), color: varchar(15)) Catalog(sid: integer, pid: integer, cost: real) The key fields are underlined Domains of each field are listed after field name The Catalog relation lists prices charged for parts by Suppliers Write the following queries in relational algebra (30 points): (i) Find the names of suppliers who supply some blue part (i) Find the sids of suppliers who do not supply a red part (ii) Find the sids of suppliers who supply some blue or red part (iv) Find the sids of suppliers who supply some blue part and some red part (v) Find the sids of suppliers who supply every blue part (vi) Find the pids of parts supplied by every supplier at less than $50. (lf a supplier either does not supply the part or charges more than $50, the part is not selected.)Explanation / Answer
1)select sname
from Suppilers S
inner join Catalog C
on C.Sid=S.Sid
inner join Parts P
on P.Pid=C.Pid
where P.color='blue'
2)select S.Sid
from Suppilers S
inner join Catalog C
on C.Sid=S.Sid
inner join Parts P
on P.Pid=C.Pid
where P.color<>'red'
3)select S.Sid
from Suppilers S
inner join Catalog C
on C.Sid=S.Sid
inner join Parts P
on P.Pid=C.Pid
where P.color='red' or P.color='blue'
4)select S.Sid
from Suppilers S
inner join Catalog C
on C.Sid=S.Sid
inner join Parts P
on P.Pid=C.Pid
where P.color='red' and P.color='blue'
5)select sname
from Suppilers S
inner join Catalog C
on C.Sid=S.Sid
inner join Parts P
on P.Pid=C.Pid
where P.color='blue'
6)select Pid from Parts P
inner join Catalog C
on C.Sid=P.Sid
inner join Suppilers S
on S.Sid=C.Sid
where C.cost<50
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.