Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a query to get the number of products that falls under each price bracket. Price bracket can be created using the following criteria. (
Write a query to get the number of products that falls under each price bracket.
Price bracket can be created using the following criteria.
Hint: Price is higher than or equal to then TIER
Price between the and then TIER
Price less than or equal to then TIER
Select only one option
SELECT
PRICEBRACKET,
COUNTPRICEBRACKET AS COUNTOFPRODUCTS
FROM PRODUCT
WHERE PRICEBRACKET IN
SELECT PRODUCTID
PRODUCTPRICE,
CASE
WHEN PRODUCTPRICE THEN 'TIER
WHEN PRODUCTPRICE BETWEEN AND THEN 'TIER
WHEN PRODUCTPRICE THEN 'TIER
ELSE PRODUCTPRICE
END AS PRICEBRACKET
FROM PRODUCT
AS P
GROUP BY PRICEBRACKET;
SELECT
PRICEBRACKET,
COUNTPRICEBRACKET AS COUNTOFPRODUCTS
FROM
SELECT PRODUCTID
PRODUCTPRICE,
CASE
WHEN PRODUCTPRICE THEN 'TIER
WHEN PRODUCTPRICE BETWEEN AND THEN 'TIER
WHEN PRODUCTPRICE THEN 'TIER
ELSE PRODUCTPRICE
END AS PRICEBRACKET
FROM PRODUCT
AS P
GROUP BY PRICEBRACKET;
SELECT
PRICEBRACKET,
PRICEBRACKET
FROM
SELECT PRODUCTID
PRODUCTPRICE,
CASE
WHEN PRODUCTPRICE THEN 'TIER
WHEN PRODUCTPRICE BETWEEN AND THEN 'TIER
WHEN PRODUCTPRICE THEN 'TIER
ELSE PRODUCTPRICE
END AS PRICEBRACKET
FROM PRODUCT
AS P
GROUP BY PRICEBRACKET;
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