By: Rishi Raj
SQL Project: Retail Store Sales
Management
Dataset, Questions, Queries &
Output
Dataset Overview
• Tables Involved:
• - Customers
• - Products
• - Orders
• Theme: Retail Store Sales Management
Customers Table
• CustomerID | Name | City | JoinDate
• 1 | Rahul Sharma | Delhi | 2022-01-15
• 2 | Priya Patel | Mumbai | 2022-03-10
• 3 | Arjun Mehta | Bengaluru | 2022-05-05
• 4 | Riya Singh | Kolkata | 2023-01-22
• 5 | Aman Khan | Hyderabad | 2023-04-12
Products Table
• ProductID | ProductName | Category |
Price
• 101 | Laptop | Electronics | 60000
• 102 | Mobile Phone | Electronics |
20000
• 103 | Office Chair | Furniture | 7000
• 104 | Water Bottle | Stationery | 500
• 105 | Notebook | Stationery | 100
Orders Table
• OrderID | CustomerID | ProductID | Quantity
| OrderDate
• 1001 | 1 | 101 |1 | 2022-01-20
• 1002 | 2 | 102 |2 | 2022-04-15
• 1003 | 1 | 103 |3 | 2022-07-10
• 1004 | 3 | 104 |4 | 2022-09-05
• 1005 | 2 | 105 | 10 | 2022-11-11
Q: Customers Joined After 2023
• Query:
• SELECT * FROM Customers WHERE JoinDate >
'2023-01-01';
• Sample Output:
• Riya Singh, Aman Khan
Q: Total Number of Orders
• Query:
• SELECT COUNT(*) AS TotalOrders FROM
Orders;
• Sample Output:
• 10
Q: Order Total Amount
• Query:
• SELECT OrderID, Quantity, Price * Quantity AS
Total FROM ...
• Sample Output:
• 1001 - 60000, 1002 - 40000
Q: Avg Price per Category
• Query:
• SELECT Category, AVG(Price) FROM Products
GROUP BY Category;
• Sample Output:
• Electronics: 40000
Q: Customer with Highest Spend
• Query:
• SELECT Name, SUM(...) AS TotalSpent GROUP
BY Name ORDER BY TotalSpent DESC LIMIT 1;
• Sample Output:
• Rahul Sharma - 81000
Q: Orders in 2022
• Query:
• SELECT * FROM Orders WHERE
YEAR(OrderDate) = 2022;
• Sample Output:
• 1001, 1002, 1003, ...
Q: Products Ordered per Customer
• Query:
• SELECT Name, SUM(Quantity) FROM ...
GROUP BY Name;
• Sample Output:
• Priya Patel - 12
Q: Customers Who Ordered Laptop
• Query:
• SELECT DISTINCT Name FROM ... WHERE
ProductName = 'Laptop';
• Sample Output:
• Rahul Sharma, Aman Khan
Q: Revenue by Product
• Query:
• SELECT ProductName, SUM(Quantity * Price)
FROM ... GROUP BY ProductName;
• Sample Output:
• Laptop: 120000
Q: Most Ordered Product
• Query:
• SELECT ProductName, SUM(Quantity)
FROM ... ORDER BY SUM DESC LIMIT 1;
• Sample Output:
• Notebook - 15
Q: Different Products per Customer
• Query:
• SELECT Name, COUNT(DISTINCT ProductID)
FROM ...
• Sample Output:
• Rahul Sharma - 3
Q: Monthly Orders in 2023
• Query:
• SELECT MONTH(OrderDate), COUNT(*)
FROM ... WHERE YEAR(OrderDate) = 2023
GROUP BY MONTH;
• Sample Output:
• Feb: 1, Mar: 1, Jun: 1, Jul: 1