***SQL DML*** Write SQL statements to answer the following questions. Note that
ID: 3775764 • Letter: #
Question
***SQL DML***
Write SQL statements to answer the following questions. Note that you do not need data tuples to answer these questions. Use the following relational schema.
Supplier (sid, name, status, city)
Part (pid, name, color, weight, city)
Job (jid, name, city)
Supplies (/sid/, /pid/, /jid/, quantity)
What are the id and the name of suppliers that ship more than 5 parts (quantity) for at least two different jobs?
Supplier (sid, name, status, city)
Part (pid, name, color, weight, city)
Job (jid, name, city)
Supplies (/sid/, /pid/, /jid/, quantity)
Explanation / Answer
select sid,name from Supplier where Supplier.sid IN(select sid from Supplies where count(distinct pid)>5 AND count(distinct jid)>=2 group by sid)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.