Question: 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)

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)

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!