Stop 15 · Interview PreparationTopics · 8/10

SQL Practice Platforms (LeetCode, HackerRank, StrataScratch)

Part of the SQL Roadmap

In short

Reading about SQL isn't the same as solving under a timer. Practice sites give you hundreds of graded problems so the common patterns become automatic before your interview.

These sites offer graded SQL problems from basic to hard. Regular practice on them builds speed and exposes you to interview-style questions.

At sunrise on a rooftop, the jaadu sits cross-legged with a harmonium, practising with closed eyes, while a small stack of finished practice notebooks grows beside it.

Think of it like this

Daily riyaz

A classical singer does riyaz every morning: the same scales, then harder ragas, a little each day. On stage, the basics come without thinking, so all the attention goes to the performance. SQL practice works the same way. Solve a few problems daily, easy to hard, and joins, GROUP BY and window functions start flowing on their own.

Watch it happen

A simple practice ladder

Easy
Medium
Hard
Timed
Review

1/5Start with easy problems: filters, joins and GROUP BY. Aim for clean, correct answers.

The big ideas

What you need to know

LeetCode

Has a database problem set and SQL study plans. Popular for product company interview prep.

HackerRank

A structured SQL track from basic to advanced, and skill certificates you can add to your profile.

StrataScratch

Questions modelled on real data interviews, often with business context. Good for analyst roles.

Pick your dialect

Most sites let you choose MySQL or PostgreSQL. Practise in the one the job uses, and know the main differences.

See it in code

Walk through the code

sql
1-- Practice problem: customers who ordered in BOTH January and February 20262 3-- Solution 1: GROUP BY and count distinct months4SELECT customer_id5FROM orders6WHERE order_date >= DATE '2026-01-01'7  AND order_date <  DATE '2026-03-01'8GROUP BY customer_id9HAVING COUNT(DISTINCT EXTRACT(MONTH FROM order_date)) = 2;10 11-- Solution 2: INTERSECT two sets12SELECT customer_id FROM orders13WHERE order_date >= DATE '2026-01-01' AND order_date < DATE '2026-02-01'14INTERSECT15SELECT customer_id FROM orders16WHERE order_date >= DATE '2026-02-01' AND order_date < DATE '2026-03-01';

1/3Read the problem carefully. 'Both' is the key word.

Runs in PostgreSQL. MySQL supports INTERSECT from 8.0.31. Solving a problem twice in different ways is the fastest way to learn new patterns.

Save yourself the pain

Common mistakes

Oops

Solving 200 easy problems and avoiding anything with a window function.

Do this instead

Move up once easy ones feel routine. Interviews lean on medium-level patterns.

Oops

Looking at the solution after two minutes of being stuck.

Do this instead

Struggle for 15 to 20 minutes first, then read the solution and re-solve it the next day without looking.

Your mission

Start a 14-day streak

~30 min

Quick check

What's the most useful thing to do right after solving a practice problem?

Go deeper

  1. 1Solve 2-3 problems a day and track topics you get wrong.
  2. 2Try the free HackerRank SQL skill test once you are comfortable.
  3. 3Revisit problems after a week and solve them again from scratch.

More topics at this stop

Stuck on this topic? Ask an Insider

Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.

Download
InsideEdge