Question
Given a table product_history including records of products status & stock changes from May October 2018. You have one sample dataset attached to this test:
Given a table product_history including records of products status & stock changes from May October 2018.
You have one sample dataset attached to this test:
Dimension | Definition | |
Date | Log Date (FROM 5/1/2018 TO 10/30/2018) | |
Product ID | Unique ID for each product | |
Product Status |
+ ON: Available for Sales + OFF: Unavailable for Sales | |
Stock | Total stock of a product at specific log date |
a. Write a SQL query to find the number of product that were available for sales at the end of each month.
b. Average stock is calculated as: Total stock in a month/ total date in a month. Write a SQL query to find Product ID with the most average stock by month.
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