***SQL DML*** Write SQL statements to answer the following questions. Note that
ID: 3775766 • 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)
Use EXISTS subquery, what are the id and the name of all jobs, which job and supplier are in the same city?
Supplier (sid, name, status, city)
Part (pid, name, color, weight, city)
Job (jid, name, city)
Supplies (/sid/, /pid/, /jid/, quantity)
Explanation / Answer
select jid,jname from Job where EXISTS(select jid from Supplies where Supplies.jid=Job.jid AND Supplies.sid IN(select sid from Supplier where Supplier.city=Job.city))
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.