Answered step by step
Verified Expert Solution
Link Copied!

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)

image text in transcribed

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Temporal Databases Research And Practice Lncs 1399

Authors: Opher Etzion ,Sushil Jajodia ,Suryanarayana Sripada

1st Edition

3540645195, 978-3540645191

More Books

Students also viewed these Databases questions