Free · In-browser · No signup

Practice SQL with
real company scenarios.

Click any question below, write SQL, run it live in your browser, and understand every concept in your language.

10 questions
⚠️ Note: These questions may or may not have been asked at the companies shown — the goal is to teach SQL through real-world usecases.
# Question Company Difficulty
1
For each customer, calculate the total number of orders and total order amount per month. Treat any NULL order_amount as 0. Return customer_id, order_month (in YYYY-MM format), total_orders, and total_amount, sorted by customer_id and then order_month.
GROUP BY · strftime · COALESCE
Amazon easy
2
Find suppliers whose average product unit price is greater than the average unit price of all suppliers in the same category. Return the supplier name, category, and average unit price. Sort the results by category and then by average unit price in descending order.
JOIN · GROUP BY · AVG
Flipkart mid
3
For each reseller, calculate net revenue as the total value of delivered orders minus the total value of RTO (returned) orders. Only include resellers with at least 5 total orders. Rank resellers within their product category by net revenue, using DENSE_RANK so tied resellers share a rank. Also calculate the running total of net revenue within each category, ordered by rank (and by reseller name to break ties consistently). Return reseller_name, category, total_orders, net_revenue, category_rank, and running_net_revenue, sorted by category, then rank, then reseller name.
JOIN · CASE WHEN · GROUP BY
Meesho hard
4
Find products whose total sales quantity is greater than the average total sales quantity of products from the same brand. Return the product name, brand and total sales quantity. Sort the result by brand and total sales quantity in descending order.
JOIN · GROUP BY · SUM
Myntra mid
5
For each TV show, calculate the completion percentage based on users who started Episode 1 versus users who watched the final episode. Round the result to 2 decimal places.
JOIN · WHERE IN · GROUP BY
Netflix mid
6
For each age group, calculate the percentage of time spent sending snaps vs opening snaps out of total send+open time. Round to 2 decimal places.
JOIN · WHERE IN · GROUP BY
Snapchat mid
7
For each employee, display their name, department, latest performance rating, the previous performance rating (to track improvement), their ranking within the department, and whether their latest rating is above or below their department's average. Sort by department and ranking.
Window Functions · ROW_NUMBER · RANK
Techcorp mid
8
For each user, count the total number of likes they have sent to others. Show user name along with the count, sorted by count in descending order.
JOIN · GROUP BY · COUNT
Tinder easy
9
Find total earnings of each driver and show top 3 earning drivers per city.
JOIN · GROUP BY · SUM
Uber mid
10
For each video, calculate the percentage of viewers who watched until the end out of all viewers who started the video. Round the result to 2 decimal places.
JOIN · WHERE · GROUP BY
Youtube mid