Question Exhibit View the Exhibit and examine the structure of the SALES and STO
ID: 3911116 • Letter: Q
Question
Question Exhibit View the Exhibit and examine the structure of the SALES and STORES tables. You want to display the store name and the total quantity sold for each item in the store. Which SQL statement will give the required output? OA) SELECT str.name, sl.items_id, SUM (s1.quantity) FROM sales sl JOIN stores str ON (sl.store_idstr.store_id) GROUP BY sl.items_id, slquantity: O B) SELECT str.name, sl.items_id, SUM(sl.quantity) FROM sales sl JOIN stores str ON (s1.store_1d= str.store_id) GROUP BY str.name, sl.items_id; O C) SELECT str.name, sl.items_id, SELECT SUM (quantity) FROM sales sls ON sls.store id- sl.store id GROUP BY sls.store_id) FROM sales sl JOIN stores str ON (sl.store_idstr.store_id) O D) SELECT str.name, sl.items_id, SUM (s1.quantity) FROM sales sl JOIN stores str ON (sl.store_idstr.store_id) GROUP BY str.name, sl.items id, sl.quantityExplanation / Answer
If you have any doubts, please give me comment...
Answer B is correct because we are project two fields with one aggregate function column, for that we need to GROUP BY name and id, based on that it will calculate the SUM(quantity)
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.