SQL Practice

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

Leaderboard
Basic10 pts

Customers from Lahore

SELECT & Filtering

Solve challenge
Basic10 pts

Premium products above Rs 1,000

Sorting & Limits

Solve challenge
Basic10 pts

How many orders were cancelled?

Aggregation

Solve challenge
Basic10 pts

VIP outreach in emerging markets

SELECT & Filtering

Solve challenge
Basic10 pts

Five fattest margins in Electronics

Sorting & Limits

Solve challenge
Basic10 pts

Which sales channel loses the most orders?

Aggregation

Solve challenge
Basic10 pts

How long does a parcel really take?

String & Date Functions

Solve challenge
Basic10 pts

Signed up, never bought

Joins

Solve challenge
Basic10 pts

Flagged card payments for the fraud desk

SELECT & Filtering

Solve challenge
Basic10 pts

The five biggest paying plans right now

Sorting & Limits

Solve challenge
Basic10 pts

How healthy is the loan book?

Aggregation

Solve challenge
Basic10 pts

On time, late or still unpaid?

NULL & CASE

Solve challenge
Basic10 pts

Payday money by month

String & Date Functions

Solve challenge
Basic10 pts

Well-paid 2025 hires in Western Europe

SELECT & Filtering

Solve challenge
Basic10 pts

The five biggest cheques in the transfer market

Sorting & Limits

Solve challenge
Basic10 pts

Where does the payroll sit?

Aggregation

Solve challenge
Basic10 pts

Length of stay month by month in 2025

String & Date Functions

Solve challenge
Basic10 pts

Who is still in a bed?

NULL & CASE

Solve challenge
Basic10 pts

Long-haul legs over 9,000 km

SELECT & Filtering

Solve challenge
Basic10 pts

The five priciest tickets

Sorting & Limits

Solve challenge
Basic10 pts

Zoomi city revenue scoreboard

Aggregation

Solve challenge
Basic10 pts

Which weekday does the airline fly most?

String & Date Functions

Solve challenge
Basic10 pts

How many completed trips never got a rating?

NULL & CASE

Solve challenge
Basic10 pts

Premium fans in Brazil, Mexico and Turkey

SELECT & Filtering

Solve challenge
Basic10 pts

The long play playlist

Sorting & Limits

Solve challenge
Basic10 pts

Where do our listeners live?

Aggregation

Solve challenge
Basic10 pts

Age groups and the people who never told us

NULL & CASE

Solve challenge
Basic10 pts

Handle generator for the Q1 2026 sign-ups

String & Date Functions

Solve challenge
Intermediate25 pts

Revenue by product category

Joins

Solve challenge
Intermediate25 pts

Customers who never ordered

Joins

Solve challenge
Intermediate25 pts

Delivered orders per month

String & Date Functions

Solve challenge
Intermediate25 pts

Stars without words

NULL & CASE

Solve challenge
Intermediate25 pts

Who pays how: payment method share

Subqueries

Solve challenge
Intermediate25 pts

Podium finish: top 3 products per category

Window Functions

Solve challenge
Intermediate25 pts

Which sellers get their goods sent back?

Joins

Solve challenge
Intermediate25 pts

Repeat-purchase rate by country

CTEs & Recursion

Solve challenge
Intermediate25 pts

Month-over-month revenue rollercoaster

Window Functions

Solve challenge
Intermediate25 pts

Gadget and kitchen lovers who skip beauty

Set Operators

Solve challenge
Intermediate25 pts

Paying customers who never opened the product

Joins

Solve challenge
Intermediate25 pts

Where does the card money go?

Subqueries

Solve challenge
Intermediate25 pts

Cloudpeak MRR, month by month

CTEs & Recursion

Solve challenge
Intermediate25 pts

Rebuild the balance of account 15

Window Functions

Solve challenge
Intermediate25 pts

Angry and behind on payments

Set Operators

Solve challenge
Intermediate25 pts

Ageing report for overdue invoices

Analytics Patterns

Solve challenge
Intermediate25 pts

Build the 2025-26 league table from raw results

Analytics Patterns

Solve challenge
Intermediate25 pts

Earning more than your manager

Joins

Solve challenge
Intermediate25 pts

Departments that keep patients longer than the hospital average

Subqueries

Solve challenge
Intermediate25 pts

The top scorer of every club (ties included)

Window Functions

Solve challenge
Intermediate25 pts

Promoted stars with a clean record

Set Operators

Solve challenge
Intermediate25 pts

Which department sees the most abnormal lab results?

Joins

Solve challenge
Intermediate25 pts

Busiest routes and what they cost in minutes

Joins

Solve challenge
Intermediate25 pts

On-time scorecard by airline and quarter

NULL & CASE

Solve challenge
Intermediate25 pts

Passengers who out-spend the average traveller

Subqueries

Solve challenge
Intermediate25 pts

Building the airport watch list with set operators

Set Operators

Solve challenge
Intermediate25 pts

The longest silence between two flights

Window Functions

Solve challenge
Intermediate25 pts

Peak-hour demand ranking in every city

Window Functions

Solve challenge
Intermediate25 pts

Rider cohorts by month of first trip

CTEs & Recursion

Solve challenge
Intermediate25 pts

The silent shelf: tracks nobody has played

Joins

Solve challenge
Intermediate25 pts

Which plan do customers walk away from?

Aggregation

Solve challenge
Intermediate25 pts

Top 3 genres in every country

Window Functions

Solve challenge
Intermediate25 pts

Superfans who never wander off

Subqueries

Solve challenge
Intermediate25 pts

The comeback kids of 2026

Set Operators

Solve challenge
Intermediate25 pts

Skip rate by device

NULL & CASE

Solve challenge
Intermediate25 pts

The ten most valuable subscribers

NULL & CASE

Solve challenge
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