Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Need help with the following question. (SQL) 5.2 [5] Consider the following relations ORDER_INV Orderid, Invid. Orderprice, Quantity) INVENTORY (Invid, QOH, Itemid, Itemsize, Colour) ITEM
Need help with the following question. (SQL)
5.2 [5] Consider the following relations ORDER_INV Orderid, Invid. Orderprice, Quantity) INVENTORY (Invid, QOH, Itemid, Itemsize, Colour) ITEM (Itemid, Currentprice, Itemdesc, Category) From the above relations, the correct SQL to display the most popular item that has been ordered is: A. SELECT I.Itemid, I.Itemdesc FROM ITEM I, INVENTORY T, ORDER INV R WHERE I.Itemid = T.Itemid AND T.Invid = R. Invid GROUP BY I.Itemid, I.Itemdesc HAVING SUM(R. Quantity) = MAX (SUM(R. Quantity)); B. SELECT I.Itemid, I.Itemdesc FROM ITEM I, INVENTORY T, ORDER_INV R WHERE I.Itemid = T.Itemid AND T. Invid = R. Invid GROUP BY I.Itemid, 1.Itemdesc HAVING SUM(R. Quantity) (SELECT MAX (SUM(R. Quantity) FROM ITEM I, INVENTORY T, ORDER_INV R WHERE I.Itemid = T.Itemid AND T. Invid = R. Invid GROUP BY I.Itemid, 1.Itemdesc); C. SELECT I. Itemid, I. Itemdesc FROM ITEM I, INVENTORY T, ORDER_INV R WHERE I. Itemid = T.Itemid AND T. Invid = R. Invid AND SUM (R. Quantity) = (SELECT MAX (SUM(R. Quantity) FROM ITEM I, INVENTORY T, ORDER_INV R WHERE I. Itemid= T.Itemid AND T.Invid = R. Invid) GROUP BY I.Itemid, I. Itemdesc; D. SELECT I.Itemid, I. Itemdesc FROM ITEM I, INVENTORY T, ORDER_INV R WHERE I.Itemid = T.Itemid AND T. Invid - R. Invid AND SUM(R. Quantity) - (SELECT MAX (SUM(R. Quantity) FROM ITEM I, INVENTORY T, ORDER_INV R WHERE I.Itemid = T.Itemid AND T. Invid = R. Invid GROUP BY I.Itemid, I.Itemdesc); E. SELECT I.Itemid, I. Itemdesc FROM ITEM I, INVENTORY T, ORDER INV R WHERE I.Itemid = T.Itemid AND T. Invid = R. Invid AND MAX (R. Quantity) = (SELECT SUM (SUM(R. Quantity) FROM ITEM I, INVENTORY T, ORDER_INV R WHERE I.Itemid = T.Itemid AND T. Invid = R. Invid GROUP BY I.Itemid, I.Itemdesc)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started