SQL Practice

Real-life business problems on real tables. Read the scenario, write the query, and get it checked instantly.

Leaderboard
Expert50 pts

Best-selling product in each category

Window Functions

Solve challenge
Expert50 pts

Running total of revenue by month

Window Functions

Solve challenge
Expert50 pts

Employees paid above their department average

Subqueries

Solve challenge
Expert50 pts

The second order that beat the first

Window Functions

Solve challenge
Expert50 pts

Heartbeat shoppers: gaps between orders

Analytics Patterns

Solve challenge
Expert50 pts

Basket pairs: what sells together

Joins

Solve challenge
Expert50 pts

30-day retention by first-order cohort

Analytics Patterns

Solve challenge
Expert50 pts

Black Friday month: the 7-day rolling average

CTEs & Recursion

Solve challenge
Expert50 pts

The typical basket: median order value by country

Window Functions

Solve challenge
Expert50 pts

Seller scoreboard: three half-years side by side

Aggregation

Solve challenge
Expert50 pts

The net new MRR waterfall

Analytics Patterns

Solve challenge
Expert50 pts

Three swipes in ten minutes

Window Functions

Solve challenge
Expert50 pts

The deepest balance drawdown

Window Functions

Solve challenge
Expert50 pts

Does week-one API usage predict churn?

Analytics Patterns

Solve challenge
Expert50 pts

Most active card holder in every country

Window Functions

Solve challenge
Expert50 pts

Upgraded, regretted, downgraded

Joins

Solve challenge
Expert50 pts

The 30-day readmission rate per department

Window Functions

Solve challenge
Expert50 pts

Hot streaks: each club's longest run of wins

Analytics Patterns

Solve challenge
Expert50 pts

Span of control: who really runs the org?

CTEs & Recursion

Solve challenge
Expert50 pts

The second-highest salary in every country

Window Functions

Solve challenge
Expert50 pts

Quarter by quarter: how fast is Nordvik growing?

CTEs & Recursion

Solve challenge
Expert50 pts

Patients whose labs stayed abnormal on back-to-back tests

Analytics Patterns

Solve challenge
Expert50 pts

Gaps and islands: every driver's longest working streak

Window Functions

Solve challenge
Expert50 pts

Drivers whose rating slid three weeks in a row

Window Functions

Solve challenge
Expert50 pts

Hub detection with a self join

Joins

Solve challenge
Expert50 pts

Lahore to New York with at most two stops

CTEs & Recursion

Solve challenge
Expert50 pts

What does surge pricing really do?

Analytics Patterns

Solve challenge
Expert50 pts

Out and back within a week: round-trip travellers

Joins

Solve challenge
Expert50 pts

How much of the fleet really flies each month?

Analytics Patterns

Solve challenge
Expert50 pts

Sessionization: the ten longest listening sessions

Window Functions

Solve challenge
Expert50 pts

Longest listening streak (gaps and islands)

Analytics Patterns

Solve challenge
Expert50 pts

Month-1 and month-2 retention by sign-up cohort

Analytics Patterns

Solve challenge
Expert50 pts

Filling the empty days: May 2026 daily plays

CTEs & Recursion

Solve challenge
Expert50 pts

Listeners on a three-month growth run

Joins

Solve challenge
Expert50 pts

VIP outreach: the top 10 percent of listeners

Window Functions

Solve challenge
Expert50 pts

New versus returning listeners, month by month

CTEs & Recursion

Solve challenge