SQL Subquery Questions
Single Row Subquery
1. Find the customer(s) who placed an order equal to the highest order amount.
2. Get the email of the customer who made the earliest order.
3. List customers from the same country as the customer named 'Alice Smith'.
4. Find orders that match the average order amount.
5. Get the name of the customer who placed the last order.
Multiple Row Subquery
6. List names of customers who have placed any order.
7. Find customers from countries that have at least one order placed.
8. List customers who made orders of amount greater than 100.
9. Get the customer IDs who made orders on February 2025.
10. Find all order amounts made by customers from India.
Correlated Subquery
11. Find customers who placed more than one order.
12. Get orders where the amount is greater than the average amount of that customer's orders.
13. List customers who placed an order with the maximum amount they ever spent.
14. Find orders that are the first order for each customer.
15. List customers who placed exactly two orders.
Non-Correlated Subquery
16. List all customers who are not from the same country as 'Bob Johnson'.
17. Get the customers who placed orders greater than the average order amount.
18. Get the highest order amount.
19. Show the total number of customers who made at least one order.
20. Get all orders made by customers from 'UK'.
Nested Subquery
21. Get customers who made orders greater than the average of the highest order per customer.
22. List customers whose minimum order is greater than 50.
23. Find customers who made more orders than the average order count per customer.
24. List all orders with amount greater than the minimum order made by customers from 'Canada'.
25. Get customers whose max order is greater than the overall average order.