Practice SQL
Solve problems on your own, from easy to hard. Every problem runs in your browser and checks your answer.
Level 1
0 / 30 XP
Data Newbie
30 XP to the next level
0 / 127 solved
Mock interviews
An interviewer asks one question at a time, and each answer builds on the last. Three interviews per company: easy, medium and hard.
Airbnb0 / 3
Amazon0 / 3
Apple0 / 3
Capital One0 / 3
DoorDash0 / 3
Google0 / 3
Instacart0 / 3
LinkedIn0 / 3
Meta0 / 3
Microsoft0 / 3
Netflix0 / 3
PayPal0 / 3
Pinterest0 / 3
Spotify0 / 3
Supercell0 / 3
TikTok0 / 3
Uber0 / 3
Skill drills
One skill at a time, in situations from different companies.
Basics0 / 5
- Customers with missing detailsAmazon · null, coalesce10 XPEasy
- Long movies added recentlyNetflix · filtering, sorting10 XPEasy
- Top-rated pizza placesDoorDash · like, filtering, sorting10 XPEasy
- Well-rated budget stays in TokyoAirbnb · filtering, sorting10 XPEasy
- Second page of the priciest tripsUber · sorting, limit, offset20 XPMedium
Aggregation0 / 5
- Cash trips by cityUber · aggregation, having10 XPProEasy
- Catalogue size by countryNetflix · group by, avg and null10 XPProEasy
- Payment volume by currencyPayPal · group by, sum, avg, max10 XPProEasy
- Pay by departmentMicrosoft · group by, having, min and max20 XPProMedium
- Pricey neighbourhoodsAirbnb · group by, having20 XPProMedium
CASE WHEN0 / 5
- Short, medium and long tripsUber · case when, conditional counts, pivot10 XPProEasy
- Devices by age groupNetflix · joins, pivot, conditional counts20 XPProMedium
- Outcomes by risk bandPayPal · case when, pivot, ratios20 XPProMedium
- Player spending segmentsSupercell · case when, left join, coalesce20 XPProMedium
- Tipping habits by cityDoorDash · case when, ratios, joins20 XPProMedium
CTEs0 / 5
- Heavy viewers this yearNetflix · ctes, dates, having10 XPProEasy
- Unusually large ordersAmazon · ctes, cross join, filtering10 XPProEasy
- Click-through rate by positionGoogle · ctes, cross join, ratios20 XPProMedium
- How many active users post?Meta · ctes, side-by-side metrics, ratios20 XPProMedium
- Standout restaurants in each cityDoorDash · ctes, joins, group comparisons20 XPProMedium
Joins0 / 8
- Projects with nobody assignedMicrosoft · anti-join, left join10 XPProEasy
- Revenue by vehicle typeUber · inner join, group by10 XPProEasy
- Do superhosts get better reviews?Airbnb · joins, case when, aggregation20 XPProMedium
- Loyal category buyersAmazon · joins, count distinct, having20 XPProMedium
- Posts nobody likedMeta · anti-join, aggregation, ratios20 XPProMedium
- Revenue share by categoryAmazon · joins, ctes, percent of total20 XPProMedium
- Team size for every managerMicrosoft · self join, aggregation20 XPProMedium
- Watchers who never rateNetflix · anti-join, exists, ratios20 XPProMedium
Dates and times0 / 6
- Signups by quarterNetflix · to_char, date parts, group by10 XPProEasy
- Weekend vs weekday faresUber · day of week, case when, aggregation10 XPProEasy
- How far ahead do guests book?Airbnb · date math, conditional counts20 XPProMedium
- How long until items come back?Amazon · date math, joins, aggregation20 XPProMedium
- Late deliveries by cuisineDoorDash · joins, dates, conditional counts20 XPProMedium
- Waiting time by hour of dayUber · epoch, extract hour, aggregation20 XPProMedium
Strings0 / 5
- Display names and handlesMicrosoft · concatenation, left, lower10 XPProEasy
- First and last genreNetflix · split_part, lists in a cell10 XPProEasy
- Long search queriesGoogle · string_to_array, array_length, group by10 XPProEasy
- Clean up payouts by monthPayPal · replace, regex, casting, conditional counts20 XPProMedium
- Most common amenitiesAirbnb · unnest, string_to_array, percent of total20 XPProMedium
Sets and duplicates0 / 4
Window functions0 / 7
- Day-over-day change in MarchUber · lag, missing dates, joins20 XPProMedium
- The first thing players buySupercell · row_number, joins, date math20 XPProMedium
- Top three restaurants in each cityDoorDash · rank, top n per group, joins20 XPProMedium
- Top two salary levels per departmentMicrosoft · dense_rank, top n per group20 XPProMedium
- What do people watch second?Netflix · row_number, lag, date math20 XPProMedium
- Each wallet's lowest pointPayPal · running totals, row_number, top per group40 XPProHard
- Longest losing streaksSupercell · window functions, gaps and islands40 XPProHard
Statistics0 / 4
Analytics patterns0 / 5
- Cart abandonment by deviceAmazon · funnels, bool_or, ratios20 XPProMedium
- How long before people come back?Netflix · lead, reactivation, date math20 XPProMedium
- Weekly active usersMeta · active users, date_trunc, count distinct20 XPProMedium
- Longest time away from the officeMicrosoft · lag, duplicates, gaps40 XPProHard
- Searches rewritten within a minuteGoogle · lead, not exists, ratios40 XPProHard
Business cases
Real-world questions that combine several skills, some in step-by-step parts.
- Are promo codes worth it?Amazon · aggregation, coalesce, ctes, cross join, conditional counts · 3 steps60 XPProMedium
- How fast are reported posts removed?Meta · joins, date math, conditional counts, ctes20 XPProMedium
- Merchants with too many refundsPayPal · ctes, cross join, joins, ratios20 XPProMedium
- Search quality by queryGoogle · exists, aggregation, ctes, min · 2 steps40 XPProMedium
- Where do players quit the tutorial?Supercell · funnels, lag, conditional counts, joins · 3 steps60 XPProMedium
- Champions and at-risk customersAmazon · ntile, ctes, case when, date math40 XPProHard
- Courier workload in DecemberDoorDash · lead, date math, count distinct, ctes40 XPProHard
- Does the first genre keep new users?Netflix · window functions, strings, dates, exists, conditional counts40 XPProHard
- Double-booking auditAirbnb · overlaps, self join, least and greatest, aggregation · 2 steps80 XPProHard
- Investigate the February dipUber · missing dates, window frames, ctes, joins · 3 steps120 XPProHard
- Pay at each level of the org chartMicrosoft · recursive cte, joins, aggregation40 XPProHard
- Payment volume in US dollarsPayPal · forward fill, joins, generate series, case when, aggregation40 XPProHard
- Peak drivers online each dayUber · overlaps, running totals, union all, aggregation40 XPProHard
- Which plan loses the most subscribers?Netflix · joins, conditional counts, date math, mode · 3 steps120 XPProHard