The most common SQL interview questions with clear answers — joins, keys, indexes, window functions and more. Practise them live in a free AI mock interview.
Practise these in a free AI mock interviewINNER (matches in both), LEFT and RIGHT (all rows from one side plus matches), FULL OUTER (all rows from both), and CROSS (every combination). A self-join joins a table to itself.
A primary key uniquely identifies each row (unique, not null). A foreign key references another table's primary key, enforcing the relationship and integrity between tables.
An index speeds up lookups, filters and sorts on a column, like a book's index. Add them on columns used in WHERE/JOIN/ORDER BY — but not everywhere, since indexes slow writes and use storage.
GROUP BY collapses rows sharing a value so you can aggregate: SELECT region, SUM(sales) FROM orders GROUP BY region returns total sales per region.
A function that computes across a set of rows related to the current row without collapsing them — ROW_NUMBER(), RANK(), running SUM() OVER (PARTITION BY ... ORDER BY ...). Ideal for rankings and running totals.
DELETE removes selected rows (can use WHERE, logged, roll-back-able). TRUNCATE quickly removes all rows with minimal logging. DROP removes the entire table structure.
A query nested inside another, in SELECT, FROM or WHERE — e.g. find employees earning above the average using (SELECT AVG(salary) ...).
WHERE filters rows before grouping; HAVING filters groups after GROUP BY. Use WHERE for raw conditions and HAVING for aggregate conditions.
GROUP BY the columns that define a duplicate and use HAVING COUNT(*) > 1 to list the values that repeat.
Normalization splits data to remove redundancy (better integrity, more joins). Denormalization combines data to speed reads (fewer joins, some redundancy) — common in reporting and analytics.
Knowing the answers isn’t enough — say them out loud
Practise these SQL questions in a free AI mock interview: answer by voice, get instant feedback on your strengths and the gaps to fix.
Admissions open · free to apply
Attended a masterclass or have a friend's referral code? You get ₹15,000 off. Fill this and our team takes it from here — pay by cash or online.