Tasks
1.👉List all employees with their department and salary.
2.Show only the name and hire_date of every employee.
3.Find all employees in the 'Sales' department.
4.List all products with price under ₹1,000.
5.Find all customers from India.
6.Show employees hired after 2022-01-01.
7.List all distinct product categories.
8.Find orders with status = 'pending'.
9.Find employees whose name starts with 'A'.
10.Find products that are out of stock (stock = 0).
11.List all employees sorted by salary — highest first.
12.Show the top 3 most expensive products.
13.Find employees with salary between ₹60,000 and ₹80,000.
14.List employees NOT in the 'IT' department.
15.Find employees who have a manager (manager_id is not null).
16.Count how many employees are in each department.
17.What is the average salary per department, ordered highest first?
18.Which department has the highest total payroll?
19.How many orders has each customer placed? (include customers with 0 orders)
20.What is the total revenue from all completed orders?
21.Show each employee's name and their manager's name.
22.Which customers have placed at least one order?
23.Which customers have NEVER placed an order?
24.Show each order with the customer name.
25.List each order item with customer name, product name, qty, unit price.
26.Find products that have been ordered at least once.
27.Find products that have NEVER been ordered.
28.Show total revenue per customer, highest first.
29.Which month had the highest revenue in 2024?
30.Find employees earning more than the overall average salary.
31.Find employees earning more than their own department average.
32.Show departments with more than 2 employees.
33.Get the 2nd highest salary in the company.
34.List all January 2024 orders placed by Indian customers.
35.Find customers who placed orders in both January AND February 2024.
36.Rank employees within each department by salary (highest = rank 1).
37.Show only the top earner per department.
38.Show a running cumulative total of order amounts by date.
39.For each order, show the previous order's total (LAG).
40.Calculate month-over-month revenue change (absolute + % change) for 2024.
41.Show each order's total as a percentage of the company's total revenue.
42.Label each customer as VIP (>₹1,00,000), Regular (>₹10,000), or New.
43.Find which product has generated the most total revenue.
44.Show all employees with their full hierarchy level (recursive CTE).
45.Show product category revenue and each category's % share of total.
46.For each employee, show their salary rank within the company (NTILE quartile).
47.Show the 3-month moving average of monthly revenue.
48.Find which day of the week has the most orders.
49.Show each order with a 'streak number' — consecutive orders by the same customer.
50.Build a complete customer health report: name, total orders, total spent, avg order value, days since first order, days since last order.