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
Step: 1
The code of SQL is as follow WITH IntermediateTable AS SELECT Custo...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 StartedRecommended Textbook for
Advanced Accounting
Authors: Gail Fayerman
1st Canadian Edition
9781118774113, 1118774116, 111803791X, 978-1118037911
Students also viewed these Databases questions
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
View Answer in SolutionInn App