SQL Interview Roadmap for Beginners: A 30-Day Plan
Codevity Admin · 10/25/2026
Step 1 of 25 · SQL Interview Preparation for Beginners · Stage 1: Start here
Codevity Admin · 10/25/2026
Most SQL interviews for freshers (0 to 1 year of experience) follow the same pattern. There is a short round of fundamentals (keys, constraints, DELETE versus TRUNCATE), a few questions on filtering, NULL, aggregates and joins, one or two query-writing tasks such as "find the second highest salary", and a little theory on indexes, transactions and normalization.
This roadmap turns that pattern into a 30-day plan and shows where each topic lives in this collection.
Many interview panels use Microsoft SQL Server (T-SQL), so this collection is written with it in mind. Almost every example is standard SQL that also runs on PostgreSQL and mostly on MySQL. Where SQL Server behaves differently, the text says "In SQL Server", so you can answer for either.
| Task | SQL Server | PostgreSQL | MySQL |
|---|---|---|---|
| First N rows | TOP (5) or OFFSET ... FETCH | LIMIT 5 or FETCH FIRST 5 ROWS ONLY | LIMIT 5 |
| Current date and time | GETDATE() | now() | NOW() |
| Replace NULL | ISNULL(x, 0) or COALESCE(x, 0) | COALESCE(x, 0) | IFNULL(x, 0) or COALESCE(x, 0) |
| Auto-numbering column | IDENTITY(1,1) | GENERATED ALWAYS AS IDENTITY | AUTO_INCREMENT |
| Days | Focus | Study this | Goal |
|---|---|---|---|
| 1 to 6 | Foundations: keys, constraints, NULL, execution order | SQL fundamentals, SELECT, WHERE and NULL, SQL Basics quiz | Write clean single-table queries and explain how NULL behaves |
| 7 to 12 | Aggregates and joins | GROUP BY and HAVING, SQL joins, Joins and Aggregates quiz | Combine tables without accidental duplicates or row explosions |
| 13 to 18 | Subqueries, CTEs and set operators | Subqueries, EXISTS and CTEs, customers without orders | Write modular SQL, use anti-joins, avoid the NOT IN trap |
| 19 to 24 | Window functions, indexes, transactions | Window functions, indexes, transactions, Logic, Subqueries and Windows quiz | Solve ranking and running-total problems, explain how an index helps |
| 25 to 27 | Database design | Normalization, Indexes, Design and Transactions quiz | Explain 1NF to 3NF and design a small schema |
| 28 to 30 | Interview mastery | 20 mistakes, Top 50 questions | Answer under time pressure and explain your reasoning aloud |
Reading is not enough: SQL sticks when you type it. Install SQL Server Express with SQL Server Management Studio, or use PostgreSQL, and create these small tables. Most examples in this collection use them.
The data is small on purpose, and it contains the situations interviewers like: two people on the same salary (Ben and Carla), an employee with no salary (Farid), an employee with no department (Gita), a department with no employees (HR), a top-level employee with no manager (Asha), a customer with no orders (Carla), and an order that belongs to no customer (order 13).
An hour a day beats a weekend of cramming:
Start with SQL fundamentals for interviews. Each step in this collection has its own page, so you can also jump straight to the topic you need.
NULLNULLCREATE TABLE departments (
id INT PRIMARY KEY,
name VARCHAR(50) NOT NULL
);
CREATE TABLE employees (
id INT PRIMARY KEY,
name VARCHAR(50) NOT NULL,
department_id INT NULL REFERENCES departments (id),
manager_id INT NULL REFERENCES employees (id),
salary DECIMAL(10, 2) NULL,
hired_on DATE NOT NULL
);
CREATE TABLE customers (
id INT PRIMARY KEY,
name VARCHAR(50) NOT NULL
);
CREATE TABLE orders (
id INT PRIMARY KEY,
customer_id INT NULL REFERENCES customers (id),
order_date DATE NOT NULL,
total DECIMAL(10, 2) NOT NULL,
status VARCHAR(20) NOT NULL
);
INSERT INTO departments (id, name) VALUES
(1, 'Engineering'), (2, 'Sales'), (3, 'HR');
INSERT INTO employees (id, name, department_id, manager_id, salary, hired_on) VALUES
(1, 'Asha', 1, NULL, 90000, '2022-03-01'),
(2, 'Ben', 1, 1, 75000, '2023-06-15'),
(3, 'Carla', 1, 1, 75000, '2024-01-10'),
(4, 'Dev', 2, 1, 60000, '2023-09-01'),
(5, 'Esha', 2, 4, 55000, '2024-04-20'),
(6, 'Farid', 2, 4, NULL, '2025-02-03'),
(7, 'Gita', NULL, 1, 50000, '2025-07-14');
INSERT INTO customers (id, name) VALUES
(1, 'Asha'), (2, 'Ben'), (3, 'Carla');
INSERT INTO orders (id, customer_id, order_date, total, status) VALUES
(10, 1, '2026-10-01', 40.00, 'paid'),
(11, 1, '2026-10-05', 15.50, 'pending'),
(12, 2, '2026-10-05', 99.00, 'paid'),
(13, NULL, '2026-10-20', 5.00, 'paid');