Given the relations below, write the following queries using SQL (5 points each)
ID: 3722003 • Letter: G
Question
Given the relations below, write the following queries using SQL (5 points each). Note that the tables contain sample records only and stored in these tables. do not represent all the possible records that could be MEMB ERS MEMBER ID NAME Brooks Smith Brown Jones ADDRESS 1 Main Street 2 Main Street 3 Main Street 4 Main Street BALANCE 9.50 30.00 0.00 10.00 4 ORDERS ORDER NO MEMBER ID SNO ITEM Vegetable Oil Flour Cauliflower UANTITY 10 4 4 4 4 Lettuce Flour Flour Sugar Vegetable Oil SUPPLIERS SNAME A Produce B Supply C Inc SNO CITY Chica Oak Park ChicaExplanation / Answer
1-SELECT MEMBERS.NAME FROM MEMBERS INNER JOIN ORDERS ON MEMBERS.MEMBER_ID=ORDERS.MEMBER_ID
WHERE ORDERS.ITEM="Sugar" AND ORDERS.QUANTITY>=3;
2-SELECT MEMBERS.NAME FROM MEMBERS INNER JOIN ORDERS ON MEMBERS.MEMBER_ID=ORDERS.MEMBER_ID
INNER JOIN SUPPLIERS ON ORDERS.SNO=SUPPLIERS.SNO;
3-SELECT MEMBERS.NAME FROM MEMBERS INNER JOIN ORDERS ON MEMBERS.MEMBER_ID<>ORDERS.MEMBER_ID;
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.