What should I actually practise to be ready for a SQL interview?
Drill the building blocks, not the trivia. Almost every SQL interview question is a combination of a small number of patterns, and the patterns are learnable in an afternoon.
CREATE TABLE customers (
id INTEGER PRIMARY KEY,
name VARCHAR(120) NOT NULL,
city VARCHAR(80) NOT NULL
);
CREATE TABLE orders (
id INTEGER PRIMARY KEY,
customer_id INTEGER NOT NULL,
amount DECIMAL(10, 2) NOT NULL,
placed_on TEXT NOT NULL
);
INSERT INTO customers (id, name, city) VALUES
(1, 'Ada Lovelace', 'London'),
(2, 'Grace Hopper', 'New York'),
(3, 'Alan Turing', 'London');
INSERT INTO orders (id, customer_id, amount, placed_on) VALUES
(1, 1, 120.00, '2026-01-05'),
(2, 1, 340.50, '2026-01-20'),
(3, 2, 75.25, '2026-02-03'),
(4, 3, 90.00, '2026-02-14');
-- Block 1: aggregation and grouping.
SELECT c.city,
COUNT(o.id) AS order_count,
ROUND(SUM(o.amount), 2) AS revenue
FROM customers AS c
JOIN orders AS o ON o.customer_id = c.id
GROUP BY c.city
ORDER BY revenue DESC;Three rows come back: London with 2 orders and 210.00, New York with 1 order and 75.25, and no other cities, because every customer in this data has ordered.
The blocks worth drilling are these. Aggregation with GROUP BY and HAVING. The three join types and what each one keeps. Subqueries in the SELECT, WHERE and FROM clauses. Window functions, particularly ROW_NUMBER, LAG and running totals. Set operations. And the data-modifying statements, because a surprising share of SQL interviews ask you to update or delete safely rather than just to select.
For each block, practise until you can write it without looking up the syntax and can say what the row count will be before you run it. That last habit is the thing that separates a candidate who knows SQL from one who has practised SQL. The interviewer is usually watching whether you reason about the data, and being able to predict the output is the clearest possible evidence that you do.