Decompose the following SELECT statement to show the intermediate table before grouping. Your answer should contain a
Fantastic news! We've Found the answer you've been seeking!
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 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;
Related Book For
Posted Date: