SQL DML Write SQL statements to answer the following questio
***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 subquery, what are the id and the name of all suppliers, whose total quantity is larger than the total quantity of all suppliers in city ‘London’?
| Supplier (sid, name, status, city) Part (pid, name, color, weight, city) Job (jid, name, city) Supplies (/sid/, /pid/, /jid/, quantity) |
Solution
select s.sid , s.name , p.quantity from suppleir s, supplies p where
p.quantity > (select q.quantity from supplies q , supplier a where a.city = \'London\');
