🗄️

SQL

DDL/DML, JOINs, subqueries, indexes, transactions, isolation levels, locking, window functions, CTEs, query performance, and database design — PostgreSQL, MySQL, SQL Server & Oracle.

Practice interview questions on this topic →
1

SQL Fundamentals — DDL, DML & Constraints

beginner

SQL (Structured Query Language) is the standard language for managing relational databases. Every backend engineer, data engineer, and solution architect must master SQL fundamentals.

2

SELECT Queries — WHERE, GROUP BY, HAVING, ORDER BY

beginner

The SELECT statement is the most used SQL statement. Understanding its execution order and clause interactions is critical for writing correct and efficient queries.

3

JOINs — INNER, LEFT, RIGHT, FULL, SELF, CROSS

beginnerPro

JOINs combine rows from two or more tables based on a related column. Understanding which JOIN to use and how it executes is fundamental to SQL mastery.

4

Subqueries, EXISTS & Correlated Subqueries

beginnerPro

Subqueries are SELECT statements nested within another SQL statement. They can appear in SELECT, FROM, WHERE, and HAVING clauses.

5

Indexes — Clustered, Non-Clustered, Composite, Covering

beginnerPro

Indexes are database structures that improve query performance by allowing fast data lookup without full table scans. Understanding indexes is one of the most critical skills for database performance

6

Transactions — ACID, COMMIT, ROLLBACK, SAVEPOINT

intermediatePro

A transaction is a logical unit of work that must execute completely or not at all. Transactions ensure database integrity even in the face of errors, crashes, and concurrent access.

7

Isolation Levels — Dirty Read, Phantom Read, Non-Repeatable Read

intermediatePro

Transaction isolation levels control how much a transaction is isolated from the effects of other concurrent transactions. There is a fundamental trade-off: higher isolation = fewer anomalies + more l

8

Locking — Optimistic vs Pessimistic

intermediatePro

Locking controls concurrent access to data to prevent anomalies. The choice between optimistic and pessimistic locking dramatically affects application design and performance.

9

Window Functions — ROW_NUMBER, RANK, LEAD, LAG

intermediatePro

Window functions perform calculations across rows related to the current row WITHOUT collapsing the result into a single row (unlike GROUP BY aggregates). They are one of the most powerful SQL feature

10

CTEs — Common Table Expressions & Recursive CTEs

advancedPro

A Common Table Expression (CTE) is a named temporary result set defined within a WITH clause, available for the duration of the query. CTEs improve readability, enable recursion, and can replace compl

11

Performance — EXPLAIN ANALYZE, Partitioning & Sharding

advancedPro

SQL performance optimization is one of the most valuable skills in database work. Understanding how the query planner works, reading execution plans, and applying the right optimization strategy can t

12

Database Design — Normalization, Denormalization & Multi-Tenant

advancedPro

Database design determines the structure of your data, which affects data integrity, query performance, and maintainability. Good design starts with normalization and strategically denormalizes for pe

13

PostgreSQL Specifics — MVCC, JSONB & VACUUM

advancedPro

PostgreSQL has unique features that set it apart from other databases. Understanding these deeply is essential for PostgreSQL users.

14

Views — Simple View & Materialized View

intermediatePro

Views let you name a complex query once so everyone reuses the same definition; materialized views take that a step further by physically storing the result, trading freshness for speed.

15

Set Operators — UNION, INTERSECT, EXCEPT/MINUS

intermediatePro

SQL's set operators combine the results of two queries by set logic rather than by joining columns — the right tool whenever the question is really "which rows are in either, both, or only one of these two result sets."

16

Advanced SQL — Stored Procedures, Functions, Triggers & Sequences

advancedPro

Functions, procedures, triggers, and sequences let you push logic and guarantees into the database itself, so they hold true no matter which application or code path touches the data.

17

SQL Fundamentals Deep Dive — Data Types, NULL Handling & Query Execution Order

beginnerPro

The data type you pick, how you handle NULL, and the order SQL actually evaluates a query's clauses in are three foundational things that quietly cause a disproportionate share of real-world SQL bugs.