Answered step by step
Verified Expert Solution
Question
1 Approved Answer
A small e-commerce firm captures revenue info. The table revenue has the following description: Type Column date field date country varchar(3) category varchar(30) revenue
A small e-commerce firm captures revenue info. The table revenue has the following description: Type Column date field date country varchar(3) category varchar(30) revenue float buyers int Write a query to find the top 3 categories by revenue per buyer, along with the values. The output should be sorted in descending order for revenue per buyer and ascendinng order for category 4 Note: Use round(x, 3) to round up your values to 3 decimal places. For e.g: round (3/5,3) = 0.600 Note: Build a query string with only one statement (semicolon optional). Multiple statements (separated by semicolon) in the query string are not allowed. Sample Input Revenue date_field country category revenue buyers 2016-06-21 US Electronics 400 15 2016-06-21 US Apparel 250 2016-06-21 US Furniture 1100 6 2016-06-21 CA Stationery 100 2016-06-21 CA Electronics 150 11 25 22 42 Sample Output category- revenue_per_buyers Furniture 183.333 Apparel Electronics 14.865 22.727 A small e-commerce firm captures revenue info. The table revenue has the following description: Type Column date field date country varchar(3) category varchar(30) revenue float buyers int Write a query to find the top 3 categories by revenue per buyer, along with the values. The output should be sorted in descending order for revenue per buyer and ascendinng order for category 4 Note: Use round(x, 3) to round up your values to 3 decimal places. For e.g: round (3/5,3) = 0.600 Note: Build a query string with only one statement (semicolon optional). Multiple statements (separated by semicolon) in the query string are not allowed. Sample Input Revenue date_field country category revenue buyers 2016-06-21 US Electronics 400 15 2016-06-21 US Apparel 250 2016-06-21 US Furniture 1100 6 2016-06-21 CA Stationery 100 2016-06-21 CA Electronics 150 11 25 22 42 Sample Output category- revenue_per_buyers Furniture 183.333 Apparel Electronics 14.865 22.727 A small e-commerce firm captures revenue info. The table revenue has the following description: Type Column date field date country varchar(3) category varchar(30) revenue float buyers int Write a query to find the top 3 categories by revenue per buyer, along with the values. The output should be sorted in descending order for revenue per buyer and ascendinng order for category 4 Note: Use round(x, 3) to round up your values to 3 decimal places. For e.g: round (3/5,3) = 0.600 Note: Build a query string with only one statement (semicolon optional). Multiple statements (separated by semicolon) in the query string are not allowed. Sample Input Revenue date_field country category revenue buyers 2016-06-21 US Electronics 400 15 2016-06-21 US Apparel 250 2016-06-21 US Furniture 1100 6 2016-06-21 CA Stationery 100 2016-06-21 CA Electronics 150 11 25 22 42 Sample Output category- revenue_per_buyers Furniture 183.333 Apparel Electronics 14.865 22.727
Step by Step Solution
★★★★★
3.50 Rating (153 Votes )
There are 3 Steps involved in it
Step: 1
You can use the following SQL query to find the top 3 categories by revenue per buyer SELECT cate...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