Stores( store id: integer, name: String, address: string) Items( item name: Stri
ID: 3736956 • Letter: S
Question
Stores( store id: integer, name: String, address: string) Items( item name: String, weight: real, color: String) Inventoryl store id: integer, item name: String, price: real) 2. [8 pts] Provide the SQL that will execute these queries. Find the names of stores that have every item in their inventory. Find all pairs of store ids such that the store with the first id charges more for an item than the second store (second id) charges for the same item. Find the ids and names of all stores which have at least one green and at least one red item in inventory For every store whose inventory contains at least one green item and at least red item, print the name and price of the most expensive item in the store. a. b. c. d.Explanation / Answer
Ans:
A) select s.name from store s,inventory i where s.storeid=i.storeid;
B) select orderid,price from inventory i where i.price >(select max(price) from inventory where price<max(price) )order by items desc;
c) select sroreid,name from store where storeid in (select storeid from inventory where items=green and red);
D)select s.name,i.price from store s,inventory i where storeid in (select sroreid from inventory where items=(green and red) order by max(price) desc) ;
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.