Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Status of a product:

+ 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

You must be online to use web apps. a . True b . False

Answered: 1 week ago