Top Customers by Spend

Easy
6 views 24 Jan 2026
Tables: Orders(order_id, customer_id, total_amount, created_at). Return customer_id and total spend, sorted by spend desc....

Employees Without Manager

Easy
8 views 24 Jan 2026
Table: Employees(emp_id, name, manager_id). Find employees who have no manager....

Second Highest Salary

Easy
5 views 24 Jan 2026
Table: Employees(emp_id, salary). Return the second highest distinct salary. If it does not exist, return NULL....

Daily Active Users

Easy
9 views 24 Jan 2026
Table: Logins(user_id, login_time). Return date and number of distinct users per date....

Orders With Missing Customers

Medium
6 views 24 Jan 2026
Tables: Orders(order_id, customer_id), Customers(customer_id). List orders whose customer_id does not exist in Customers....

Products Never Sold

Medium
5 views 24 Jan 2026
Tables: Products(product_id, name), OrderItems(order_id, product_id). Find products that never appear in OrderItems....

Nth Highest Salary (Parameter N)

Hard
5 views 24 Jan 2026
Table: Employees(emp_id, salary). Write a query pattern to get the Nth highest distinct salary (assume N is given)....

Users With 3 Consecutive Logins

Hard
8 views 24 Jan 2026
Table: Logins(user_id, day). day is a date. Find users who logged in on 3 consecutive days....

Window Function Practice #9

Hard
4 views 24 Jan 2026
Table: Scores(user_id, score, created_at). Return each row with the rank of score within the same day....

Join Practice #10

Easy
5 views 24 Jan 2026
Tables: A(id, val), B(id, val). Return ids present in both tables....

Aggregation Practice #11

Medium
4 views 24 Jan 2026
Table: Sales(store_id, amount). Return store_id and average amount, only stores with at least 5 rows....

Window Function Practice #12

Hard
4 views 24 Jan 2026
Table: Scores(user_id, score, created_at). Return each row with the rank of score within the same day....

Join Practice #13

Easy
4 views 24 Jan 2026
Tables: A(id, val), B(id, val). Return ids present in both tables....

Aggregation Practice #14

Medium
4 views 24 Jan 2026
Table: Sales(store_id, amount). Return store_id and average amount, only stores with at least 5 rows....

Window Function Practice #15

Hard
4 views 24 Jan 2026
Table: Scores(user_id, score, created_at). Return each row with the rank of score within the same day....

Join Practice #16

Easy
4 views 24 Jan 2026
Tables: A(id, val), B(id, val). Return ids present in both tables....

Aggregation Practice #17

Medium
4 views 24 Jan 2026
Table: Sales(store_id, amount). Return store_id and average amount, only stores with at least 5 rows....

Window Function Practice #18

Hard
4 views 24 Jan 2026
Table: Scores(user_id, score, created_at). Return each row with the rank of score within the same day....

Join Practice #19

Easy
4 views 24 Jan 2026
Tables: A(id, val), B(id, val). Return ids present in both tables....

Aggregation Practice #20

Medium
4 views 24 Jan 2026
Table: Sales(store_id, amount). Return store_id and average amount, only stores with at least 5 rows....

Window Function Practice #21

Hard
4 views 24 Jan 2026
Table: Scores(user_id, score, created_at). Return each row with the rank of score within the same day....

Join Practice #22

Easy
5 views 24 Jan 2026
Tables: A(id, val), B(id, val). Return ids present in both tables....

Aggregation Practice #23

Medium
5 views 24 Jan 2026
Table: Sales(store_id, amount). Return store_id and average amount, only stores with at least 5 rows....

Window Function Practice #24

Hard
4 views 24 Jan 2026
Table: Scores(user_id, score, created_at). Return each row with the rank of score within the same day....

Join Practice #25

Easy
4 views 24 Jan 2026
Tables: A(id, val), B(id, val). Return ids present in both tables....

Aggregation Practice #26

Medium
4 views 24 Jan 2026
Table: Sales(store_id, amount). Return store_id and average amount, only stores with at least 5 rows....

Window Function Practice #27

Hard
8 views 24 Jan 2026
Table: Scores(user_id, score, created_at). Return each row with the rank of score within the same day....

Join Practice #28

Easy
6 views 24 Jan 2026
Tables: A(id, val), B(id, val). Return ids present in both tables....

Aggregation Practice #29

Medium
4 views 24 Jan 2026
Table: Sales(store_id, amount). Return store_id and average amount, only stores with at least 5 rows....

Window Function Practice #30

Hard
4 views 24 Jan 2026
Table: Scores(user_id, score, created_at). Return each row with the rank of score within the same day....

Join Practice #31

Easy
4 views 24 Jan 2026
Tables: A(id, val), B(id, val). Return ids present in both tables....

Aggregation Practice #32

Medium
4 views 24 Jan 2026
Table: Sales(store_id, amount). Return store_id and average amount, only stores with at least 5 rows....

Window Function Practice #33

Hard
11 views 24 Jan 2026
Table: Scores(user_id, score, created_at). Return each row with the rank of score within the same day....

Join Practice #34

Easy
4 views 24 Jan 2026
Tables: A(id, val), B(id, val). Return ids present in both tables....

Aggregation Practice #35

Medium
4 views 24 Jan 2026
Table: Sales(store_id, amount). Return store_id and average amount, only stores with at least 5 rows....

Window Function Practice #36

Hard
4 views 24 Jan 2026
Table: Scores(user_id, score, created_at). Return each row with the rank of score within the same day....

Join Practice #37

Easy
4 views 24 Jan 2026
Tables: A(id, val), B(id, val). Return ids present in both tables....

Aggregation Practice #38

Medium
4 views 24 Jan 2026
Table: Sales(store_id, amount). Return store_id and average amount, only stores with at least 5 rows....

Window Function Practice #39

Hard
5 views 24 Jan 2026
Table: Scores(user_id, score, created_at). Return each row with the rank of score within the same day....

Join Practice #40

Easy
6 views 24 Jan 2026
Tables: A(id, val), B(id, val). Return ids present in both tables....