Question
Please rewrite Query 30 and Query 31. E5.1.24 Rewrite Query 30 using a join statement (no nested queries). E5.1.25 Rewrite Query 31 using a join
Please rewrite Query 30 and Query 31.
E5.1.24 Rewrite Query 30 using a join statement (no nested queries).
E5.1.25 Rewrite Query 31 using a join statement (no nested queries).
Query 30 text: For each product that has more than three items sold within all sales transactions, retrieve the product id, product name, and product price.
Query 30:
SELECT productid, productname, productprice
FROM product
WHERE productid IN
(SELECT productid
FROM includes
GROUP BY productid
HAVING SUM(quantity) > 3);
Query 31 text: For each product whose items were sold in more than one sales transaction, retrieve the product id, product name, and product price.
Query 31:
SELECT productid, productname, productprice
FROM product
WHERE productid IN
(SELECT productid
FROM includes
GROUP BY productid
HAVING COUNT (tid) > 1);
Step by Step Solution
There are 3 Steps involved in it
Step: 1
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 Started