Books not sold in Jan | Amazon Data Analyst Interview question

 --Off all the products available in the Books category, what percentage 

-- did not have any sales in Jan 2024


DROP TABLE IF EXISTS Orders;

DROP TABLE IF EXISTS Items;


CREATE TABLE Orders

(

[Order_day] datetime,

[Order_ID] INT,

[Customer_ID] INT,

[Product_ID] INT,

[Quantity] INT

)


CREATE TABLE Items

(

[Product_ID] INT,

[Product_Name] varchar(max),

[Category] varchar(max),

[Price] INT

)


INSERT INTO Items

VALUES

(100,'Maths','Books',1000),

(200,'Science','Books',800),

(300,'Biology','Books',900),

(400,'Social','Books',700),

(500,'English','Books',500),

(600,'Pen','Stationary',10),

(700,'Pencil','Stationary',10),

(800,'Brush','Daily Use',25),

(900,'Paste','Daily Use',80) 


INSERT INTO Orders

VALUES

('01-01-2024',1562,589,100,3),

('01-02-2024',1563,590,200,3),

('01-03-2024',1564,591,900,3),

('02-19-2024',1565,595,800,3),

('04-26-2024',1566,605,700,3),

('03-10-2024',1567,696,600,3), 

('05-16-2024',1568,489,400,3),

('05-25-2024',1569,589,300,3),

('05-08-2024',1570,519,100,3),

('01-10-2024',1577,369,200,3) 


SELECT * FROM Items

SELECT * FROM Orders


Detailed Explanation: https://youtu.be/dO_o7_CacBQ

Comments

Popular posts from this blog

50 Essential SQL Questions to Land Your Dream Job

How to find all the customers who placed orders on three consecutive days | SQL Scenario questions

ACCENTURE SQL INTERVIEW QUESTION | Change the ProductIDs