⚡ Limited-time offer ends in15:00· ₹349 instead of ₹1,749
TalentdBuy now · ₹349

From Talentd · used by 1.3 lakh job seekers

Crack SQL Interviews with Real Scenario Questions

1,015 SQL interview questions and answers on Indian business data. 2026 edition.

  • 1,015 questions: 495 theory and 520 scenarios, sorted easy to hard
  • Every query run on MySQL, PostgreSQL and SQLite, with the real output
  • Instant PDF. Lifetime access. Every future edition free

₹1,749₹34980% off

That's about 34 paise a question, less than the cost of one rejected interview.

  • Instant download
  • 7-day refund
  • Lifetime access

One-time payment. No subscription. No recurring charge.

1,106 A4 pagesTested on 3 databasesBuilt on Indian company dataRazorpay secure checkout
Contents page of Crack SQL Interviews 2026Chapter 2 opener: Joins & Relationships
Contents and a chapter opener
Book page with Chapter 1 question 107Book page with Chapter 2 question 115
Scenario pages: query, output, mistake, insight
Chapter 5 opener: Window FunctionsBook page with Chapter 5 question 101
Window Functions, the most asked chapter

Built for

Freshers

Clearing your first SQL round or online test

Service-company engineers

Moving to a product company

Working professionals

The harder rounds: windows, transactions, indexing

Career switchers

Moving into a data or analyst role

/ The real test

Knowing SQL isn't what decides the round. Seeing the pattern is.

Interviewers don't check how many courses you've done. They describe a business problem and watch whether you spot the shape inside it: an anti-join, a ranking with ties, a running total, a NULL that changes the answer.

People who freeze usually know the syntax. They've just never met the question in that shape before.

This book puts 1,015 of those shapes in front of you, with the answer run and the mistake explained, so the round feels familiar.

/ See what's inside

Read 3 real questions from the book

Three questions, exactly as printed. Open the answer to see the query, the real output and the takeaway.

Chapter 2 · Q.115

Medium·Joins · Anti-joins

The anti-join that quietly returns nothing

Swiggy's partner team wants the restaurants that have never had a delivered order, so they can call the owners. A restaurant with only cancelled or pending orders, or with no orders at all, belongs on the list.

Why this trips people

Moving the status filter into WHERE: WHERE o.delivery_status = 'delivered' AND o.order_id IS NULL can never be true, so the query returns nothing. Dropping the status filter altogether is the other wrong version: it finds Chai Point (no orders) but misses Paranthe Wali Gali, whose single cancelled order counts as a match.

See the answer
SELECT r.restaurant_id, r.restaurant_name, r.city
FROM swiggy_restaurants r
LEFT JOIN swiggy_orders o
  ON o.restaurant_id = r.restaurant_id
 AND o.delivery_status = 'delivered'
WHERE o.order_id IS NULL
ORDER BY r.restaurant_id;
restaurant_idrestaurant_namecity
4Paranthe Wali GaliDelhi
5Chai PointHyderabad

Key insight. In an anti-join, every condition that defines "a matching row" goes in the ON clause, and WHERE only checks that no match was found (a right-hand key IS NULL).

Chapter 5 · Q.101

Hard·Window functions · Nth highest

Third highest salary, when salaries tie

Flipkart's VP of engineering asks: 'Find the third highest distinct salary_max_lpa across all postings. If multiple postings share that salary, return all of them.' Nth-highest salary is a staple of product-company SQL rounds.

Why this trips people

Using ROW_NUMBER or RANK instead of DENSE_RANK. ROW_NUMBER would give an arbitrary single row. RANK might skip rank 3 if there are ties at rank 2. Only DENSE_RANK guarantees rank 3 maps to the 3rd distinct value.

See the answer
SELECT company, role, salary_max_lpa
FROM (
  SELECT company, role, salary_max_lpa,
    DENSE_RANK() OVER (ORDER BY salary_max_lpa DESC) AS dr
  FROM naukri_job_postings
) ranked
WHERE dr = 3;
companyrolesalary_max_lpa
RazorpayFull Stack Developer20.00

Key insight. DENSE_RANK assigns ranks to distinct values, not rows. dr = 3 means 'all rows with the 3rd highest distinct value.'

Chapter 1 · Q.107

Hard·NULL · Three-valued logic

The NOT that skips the newest orders

The data team wrote WHERE NOT (delivery_status = 'delivered') to list all non-delivered orders. A reviewer warns that new orders can arrive before their status is set (delivery_status NULL), and this filter will silently skip them. Explain why, and write a version that keeps NULL-status orders.

Why this trips people

Assuming NOT (...) or != returns everything the positive condition leaves out. For a row with a NULL status, delivery_status = 'delivered' is UNKNOWN, NOT UNKNOWN is still UNKNOWN, and the row is dropped.

See the answer
SELECT order_id, customer_name, delivery_status
FROM swiggy_orders
WHERE delivery_status != 'delivered'
   OR delivery_status IS NULL;
order_idcustomer_namedelivery_status
1003Sneha Iyerpending
1005Ananya Desaicancelled
1007Meera Nairpending

Key insight. NOT UNKNOWN is UNKNOWN, not TRUE. If a column can be NULL, WHERE col != 'value' silently drops NULL rows. Always add OR col IS NULL if you need those rows.

₹349 for 1,015 questions. That's about 34 paise a question.

/ The diagnosis

Four reasons people who know SQL still lose the round

Whether you've been rejected before or it's your first interview next week, one of these is usually the gap.

/ 01

You practised syntax, not situations.

Tutorials teach GROUP BY on a table called orders. The round describes a business problem in three sentences and waits for you to find the GROUP BY in it.

/ 02

You stop at the first query.

“Now include the ones with no orders.” “What if two people tie?” The first query is rarely the one that decides the round. The follow-up is.

/ 03

NULL and tie traps.

NOT IN with a NULL in the list, != that silently drops rows, RANK that skips numbers. They look right until the interviewer asks what your query returns.

/ 04

Your prep is scattered.

A playlist here, a PDF there. Joins, windows, subqueries, transactions, indexing, design: without a plan you over-study one and skip the rest.

/ What's inside

1,015 questions. Two kinds of practice. One book.

495

Theory questions

The concepts you're expected to explain out loud, without thinking.

  • Joins: inner, outer, self, cross, and the NULL rules behind them
  • GROUP BY, HAVING and the aggregates interviewers actually ask
  • Subqueries, correlated subqueries and CTEs, recursive ones included
  • Window functions: ranking, LAG and LEAD, running totals, frames
  • Constraints, procedures, triggers, transactions and isolation levels
  • Normalisation, database design, indexes and reading query plans

520

Scenario questions

The business problems you have to turn into a query, on tables from companies you know.

  • Food delivery orders and restaurants (Swiggy, Zomato)
  • E-commerce sellers, products, returns (Flipkart)
  • Payments, settlements and fraud checks (Razorpay, PhonePe)
  • Banking, trading and bookings (HDFC, Zerodha, IRCTC, BookMyShow)
  • Job postings, sales teams, university results, IPL stats
  • Interview Classics: Nth highest, duplicates, streaks, gaps

/ Every scenario includes

Not just the query. The whole breakdown.

1The question

Written the way an interviewer says it, with a business story

2What it tests

The one concept the question is really about

3A query that runs

Run on MySQL, PostgreSQL and SQLite before it was printed

4The real output

The rows the query returns on the book's own data

5The common mistake

The wrong answer most people give, and why it's wrong

6The key insight

The one line to remember in the interview

/ See it before you buy

Real pages. Real questions. Real output.

Pages from the book as you'll get them, in a PDF with clickable contents.

  • Every scenario, start to finish
    Every scenario, start to finish
  • Dialect notes where databases differ
    Dialect notes where databases differ
  • The 14-day plan, day by day
    The 14-day plan, day by day
  • The bonus cheatsheet
    The bonus cheatsheet

/ How it works

From payment to practice in about a minute

  1. 1

    Pay in a minute

    Name, email and mobile, then UPI, card or net banking on Razorpay. No account needed.

  2. 2

    Download instantly

    Buttons for the book and the cheatsheet appear on screen. The same links arrive by email.

  3. 3

    Start Day 1 today

    Open the 14-day or 30-day plan in Chapter 0 and do the first question range.

/ Why you can trust the answers

Every answer was run before it was printed

A question bank is only as good as its answers. This is how this one was checked.

3

databases

Every one of the 1,015 answers was run on MySQL 8.4, PostgreSQL 17 and SQLite. 842 run unchanged on all three; the rest carry tested notes.

0

typed outputs

Result tables come from running the query on the book's 35 practice tables. None were typed by hand.

557

questions rewritten

After the engine runs, every chapter was read again for wrong claims, weak explanations and stories that didn't match the query.

/ How it compares

Why this beats another playlist

Keep the free stuff. Here's what the book adds.

Swipe to compare →

What you needBestThis book · ₹349YouTube playlistsFree PDFs and listsChatGPT
1,000+ questions in one placePartialIf you ask
Scenarios on business dataA fewIf you ask
Answers run on real databasesCan be wrong
Real output for every querySometimes
The common mistake, every timeRarelyIf you ask
A 14-day and a 30-day plan
Works offline, on your phone

/ A bonus, included

The 7-page SQL Cheatsheet

Keep it open while you practise: the order a query actually runs in, every join on one page, the window functions side by side, the NULL rules, and how MySQL, PostgreSQL, SQL Server, Oracle and SQLite differ. Every example in it was run too.

/ Limited-time offer

Everything above. ₹349 once.

⚡ Special pricing ends after 500 more sales. Then it moves to ₹599 permanently.
The math

₹349 for 1,015 questions is about 34 paise a question. No subscription, nothing to renew.

Best value

You get

  • 495 theory questions
  • 520 scenario questions
  • Query, real output, mistake and insight for each
  • SQL Cheatsheet (7-page bonus PDF)

Plus

  • 14-day and 30-day study plans
  • 35 practice tables and the load script
  • Every future edition, free
  • 7-day refund
₹1,749→₹349

80% off the MRP. Less than the cost of one rejected interview.

  • Razorpay secure
  • Instant PDF
  • 7-day refund
  • Lifetime access

One-time payment. Instant download. No recurring charges.

/ No risk

Buy it. Try the questions. Not for you? Get every rupee back.

Email support@talentd.in within 7 days of buying with your order number and we refund the full amount to your original payment method. No forms, no questions. Download access for that order ends with the refund.

/ Honest fit

Who this book is for. And who it isn't.

A good fit if

  • Your SQL round, online test or data-role interview is coming up
  • You know SELECT, WHERE and JOIN but freeze on scenario questions
  • You want one book instead of scattered videos and lists
  • You're aiming for a product company and want the harder questions

Not the right book if

  • You've never written a query. Learn the basics from a free tutorial first; it takes an evening
  • You want video lessons. This is a book you work through
  • You want a promise of the exact questions in your interview. Nobody can honestly make one

/ FAQ

Questions buyers ask

How do I get the book after paying?

The download buttons for the book and the cheatsheet appear straight away, and we email you the same links. No account needed. If you later sign up on Talentd with the same email, the kit shows in My Purchases too.

How does the 7-day refund work?

Email support@talentd.in within 7 days of buying with your order number. We refund the full amount to your original payment method; download access for that order ends with the refund.

Which database does it use?

Standard SQL that runs on MySQL, PostgreSQL and SQLite. Where they differ (dates, upserts, procedures, locking), the answer is in MySQL with notes for PostgreSQL, SQL Server, Oracle and SQLite.

I'm not a fresher. Is it worth it?

Yes. 234 questions are rated hard, and the later chapters cover transactions, isolation levels, database design and indexing, where experienced-hire rounds spend their time.

Can I read it on my phone?

Yes. It's an A4 PDF with clickable contents. It opens on any phone, tablet or laptop; long queries are easier on a bigger screen.

Is it a one-time payment?

Yes. Pay once by UPI, card or net banking. No subscription, no auto-renewal.

Can I share my copy?

No. Every page carries your name, email and order number, so a shared copy can be traced to its buyer. We cancel access for that order and may take legal action.

Who is behind it?

Talentd (talentd.in), the jobs and interview-prep site for Indian freshers and early-career engineers, with about 1.3 lakh registered job seekers.

Your next SQL round is coming. Walk in having seen the questions.

1,015 questions, the cheatsheet and the study plans, as one instant PDF.

One-time payment · Instant PDF · 7-day refund

SQL eBook
Scenario-Based SQL Interview eBook
Instant PDF·7-day refund·Lifetime access
₹349₹1,749
Offer Ends In15:00
PN
Priya N. from Mumbai just purchased the eBook ✓
2 minutes ago