Intermediate SQL

  1. Aggregation

    Question 1 of 3

    • Get the total number of customers.
    • Find employee that gets second highest salary. [Hint: use offset]
    • Find total expenditure on salary by mart on 3 month.
    • Total total number of customer on each city.
    • Calculate the average salary of employees in each department.
    • Write a query to detect if same email is reused by multiple customer.
    • On which day, highest discount was given by mart.
    • Find number of active employee across each department.
  2. Joining / SubQuery

    Question 2 of 3

    • Find the total discount amount given per customer.
    • Show customer name, product name, cashier name, quantity for each transaction done by user of kathmandu after 2025.
    • Find the total transaction, monetory value handled by each employee in july.
    • For each product, find total transaction, total item sold, txn amount (without discount) & total discount.
    • Find customers who have made more than 20 transactions.
    • List employees who haven't handled any transaction.
    • Find products that were never sold.
    • Show the employee who handled the highest number of transactions.
    • List transactions where the discount was more than 50% of the product's unit price.
    • Find the first transaction date for each customer.
    • Find the top 3 customers based on total reward points.
    • Find customers whose first transaction happened before registration.
    • List customers who purchased the same product more than once.
    • Find average spending per customer.
    • List employee name and their manager's name.
    • Identify if an inactive employee has performed transactions.
    • Find customer who haven't bought any Smartphone.
    • Find top 5 most popular brand that sells Organic Apple based on qty sold.
    • List name, address of employee who have never received discount.
    • Find list of churn customer in 2025, June. [Txn on May but not in june]
    • Find customer who bought notebook on May & June but yet to buy on July.
  3. Set Operations

    Question 3 of 3

    • Find id, name, email of customers doing transactions in 2025 June but not in July.
    • Find id, name, email of customers doing transactions in 2025 June or July.
    • Find id, name, email ofcustomers doing transactions in 2025 June and July.