0Pricing
SQL Interview Prep icon

SQL Interview Prep

SQLDataDatabaseInterviewCareer

Ace your SQL technical interview — joins, window functions, CTEs, query optimization and classic interview problems.

🤖 AI-Powered📚 30 courses👥 100,000+ learners⭐ 4.9 rating
Course Overview

Crack the SQL Interview, From Fundamentals to Window Functions

SQL is the single most tested skill in data, analytics, and backend interviews — yet most candidates stumble on the same traps: silent NULL behavior, joins that multiply rows, and the window-function questions that now show up at almost every company. This track turns interview SQL into a repeatable skill. You work through the exact question patterns asked at product and data-heavy companies, writing and running real queries against sample tables until each pattern becomes second nature.

What You Will Learn

You start with the fundamentals interviewers screen on — SELECT, column expressions, WHERE filtering gotchas, ORDER BY with LIMIT, and aggregate functions. From there you master every join type and the GROUP BY / HAVING traps that catch most candidates, plus correct NULL handling. The core of the track is the material that decides offers: subqueries and correlated subqueries, CTEs and recursive CTEs, and window functions including ROW_NUMBER, RANK, LAG/LEAD, running totals, top-N per group, and the classic Nth-highest-salary puzzles. Advanced courses cover gaps and islands, streaks, pivoting, cohort and retention analysis, funnel and A/B-test queries, query optimization with EXPLAIN, indexing strategy, transactions and isolation levels, and schema design with full mock interviews.

The Learning Path

Thirty courses progress from A1 through B2. The first two are free and cover SQL fundamentals and SELECT basics. The A1–A2 courses build the foundation — filtering, sorting, aggregation, every join type, grouping, and NULL handling. The ten B1 courses move into mid-level interview territory: subqueries, CTEs, and the full window-function toolkit modern interviews rely on. The ten B2 courses tackle senior-level analytical SQL — gaps and islands, streak and cohort analysis, funnel and A/B-test queries, performance tuning, indexing, transactions, and schema design, closing with full mock interview sessions.

How It Works

Each course is split into short, hands-on lessons you complete in the built-in editor with real-time feedback and an AI tutor on hand when you get stuck. You write and run actual queries against realistic tables — not multiple-choice trivia — so every lesson rehearses the way you will be asked to think out loud in the real interview.

Start Learning →

How You'll Learn

🎯
Interactive Lessons
Hands-on coding exercises with real-time feedback
🤖
AI Tutor
Get instant help from our AI when you're stuck
💻
Built-in Editor
Write and run code directly in your browser
🏆
Certificate
Earn a certificate when you complete the course
Curriculum

30 Courses

Every course in the SQL Interview Prep learning path.

01

SQL Fundamentals Interview Questions

A14 lessons

The most-asked SQL basics that screen out candidates in the first five minutes of an interview. Master what SQL is, how queries execute, an…

02

SELECT and Column Expression Basics

A14 lessons

Interview drills on projecting columns, aliasing, computed expressions, and DISTINCT. Covers the subtle scoping rules that trip up juniors.

03

WHERE Clause Filtering Gotchas

A14 lessonsPRO

Classic filtering interview traps: operator precedence, BETWEEN boundaries, IN vs OR, and pattern matching. Learn why a filter that looks r…

04

ORDER BY, LIMIT and Top-N Questions

A14 lessonsPRO

Sorting and pagination interview questions, including stable ordering, multi-key sorts, and the cross-dialect way to fetch the top N rows.

05

Aggregate Functions Interview Drills

A14 lessonsPRO

COUNT, SUM, AVG, MIN, MAX and their NULL behavior under interview scrutiny. The difference between COUNT(*) and COUNT(column) is a guarante…

06

Introduction to INNER JOIN

A24 lessonsPRO

The join interviewers ask first. Build a precise mental model of how INNER JOIN matches rows, multiplies on duplicates, and where the ON pr…

07

LEFT, RIGHT and FULL OUTER JOINs

A24 lessonsPRO

Outer join interview questions: preserving unmatched rows, finding missing records, and the anti-join pattern interviewers love.

08

CROSS JOIN, SELF JOIN and Join Patterns

A24 lessonsPRO

The joins that surprise candidates. Master Cartesian products, joining a table to itself, and recognizing which join a problem really needs.

09

GROUP BY and HAVING Interview Traps

A24 lessonsPRO

Grouping is where interviews separate juniors from mid-levels. Learn the GROUP BY rules, HAVING vs WHERE, and the non-aggregated-column err…

10

NULL Handling Interview Questions

A24 lessonsPRO

NULL is the number one source of wrong answers in SQL interviews. Master three-valued logic, NULL-safe comparisons, and COALESCE.

11

Subqueries Deep Dive

B14 lessonsPRO

Scalar, row, and table subqueries as interviewers present them. Know where each can appear and when a subquery is the cleanest answer.

12

Correlated Subqueries

B14 lessonsPRO

The subquery that runs once per outer row. Recognizing, writing, and rewriting correlated subqueries is a core mid-level interview skill.

13

Common Table Expressions (CTEs)

B14 lessonsPRO

WITH clauses for readable, reusable query logic. Interviewers expect you to refactor nested subqueries into clean CTEs.

14

Recursive CTEs and Hierarchies

B14 lessonsPRO

Recursive WITH for tree and graph traversal. Org charts, bill-of-materials, and number-series generation are staple advanced questions.

15

Window Functions: ROW_NUMBER, RANK, DENSE_RANK

B14 lessonsPRO

Ranking window functions, the most-tested advanced SQL topic in interviews. Understand the difference the three ranking functions produce o…

16

Window Functions: LAG, LEAD and NTILE

B14 lessonsPRO

Offset and bucketing window functions for comparing rows and distributing data into tiers. Period-over-period change is a guaranteed analys…

17

Running Totals and Moving Averages

B14 lessonsPRO

Window frame clauses for cumulative and rolling calculations. ROWS vs RANGE framing is a precise mid-level distinction interviewers probe.

18

Top-N per Group and Deduplication

B14 lessonsPRO

Two of the highest-frequency interview problems solved cleanly with window functions: top item per category and removing duplicate rows.

19

Nth Highest Salary and Ranking Puzzles

B14 lessonsPRO

The interview question every candidate gets: second highest salary, then Nth highest, with all the edge cases interviewers add.

20

Set Operations: UNION, INTERSECT, EXCEPT

B14 lessonsPRO

Combining result sets correctly. UNION vs UNION ALL, column compatibility rules, and using set operations to compare datasets.

21

Gaps and Islands Problems

B24 lessonsPRO

The advanced pattern-recognition problem class: finding consecutive runs and the gaps between them. A senior-level signal in SQL interviews.

22

Consecutive Days and Streak Analysis

B24 lessonsPRO

Streak and run-length problems: consecutive login days, winning streaks, and the LeetCode-style three-consecutive-rows question.

23

Pivot and Unpivot Techniques

B24 lessonsPRO

Reshaping data between long and wide form. Conditional aggregation pivots and the reverse unpivot are common reporting-interview asks.

24

Date, Time and String Interview Questions

B24 lessonsPRO

Date arithmetic, truncation, and string manipulation as posed in interviews, with cross-dialect awareness of function names.

25

Cohort and Retention Analysis SQL

B24 lessonsPRO

Product-analytics interview queries: building cohorts, computing retention curves, and the self-join versus window approaches.

26

Funnel and A/B Test Analysis SQL

B24 lessonsPRO

Event-funnel conversion and experiment-analysis queries that data-analyst interviews lean on heavily.

27

Query Optimization and EXPLAIN

B24 lessonsPRO

Reading execution plans and explaining why a query is slow, the senior differentiator in technical interviews.

28

Indexing Strategy Questions

B24 lessonsPRO

Index design as interviewers test it: which columns to index, composite order, covering indexes, and when indexes hurt.

29

Transactions, ACID and Isolation Levels

B24 lessonsPRO

Concurrency interview questions: ACID guarantees, the four isolation levels, and the anomalies each prevents.

30

Schema Design, Normalization and Mock Interviews

B24 lessonsPRO

Capstone course on database modeling and a set of full mock interview problems. Normalization, star schemas, and end-to-end problem solving.

FAQ

Frequently Asked Questions

Is the SQL Interview Prep course free?

Yes. You can start the SQL Interview Prep course for free and complete its interactive lessons at no cost. An optional PRO subscription unlocks advanced AI tools and a shareable certificate.

Do I need prior experience to learn SQL?

No. The course begins with the fundamentals and gradually moves to more advanced topics, so you can start even with no prior SQL experience.

How will I learn SQL on CoddyKit?

You learn by doing. Short interactive lessons pair a clear explanation with a hands-on coding exercise that runs in real time, and a 24/7 AI tutor gives personalized help whenever you get stuck.

Do I get a certificate for completing SQL Interview Prep?

Yes. PRO learners can take an exam and earn a shareable certificate of completion with a verifiable code for the SQL Interview Prep course.

Can I learn SQL on my phone?

Yes. CoddyKit is available on the web and as native iOS and Android apps, so you can learn SQL on any device and your progress syncs across them.

Start SQL Interview Prep Now

Join thousands of learners mastering programming with AI-powered lessons.

Get Started Free →Browse All Courses