Question: Decompose the following SELECT statement to show the intermediate table before grouping. Your answer should contain a SELECT statement without the GROUP BY clause. You

Decompose the following SELECT statement to show the intermediate table before grouping. Your answer should contain a SELECT statement without the GROUP BY clause. You should be able to compute the aggregate functions using the intermediate generated by your SELECT statement answer.

SELECT Customer.CustNo, CustFirstName, CustLastName, SUM(Qty) AS ProdQty, 

SUM(Qty*ProdPrice) AS TotOrdAmt

FROM OrderTbl, OrdLine, Product, Customer

WHERE OrdDate BETWEEN '1-Jan-2021' AND '31-Jan-2021'

AND OrderTbl.OrdNo = OrdLine.OrdNo

AND OrdLine.ProdNo = Product.ProdNo

AND Customer.CustNo = OrderTbl.CustNo

AND (ProdName LIKE '%Ink Jet%'

OR ProdName LIKE '%Laser%')

GROUP BY Customer.CustNo, CustFirstName, CustLastName

HAVING SUM(Qty) > 2;

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The code of SQL is as follow WITH IntermediateTable AS SELECT Custo... View full answer

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!