SQL practice sets
23 topics, free. Every topic has its own page with the questions, solved queries and real output. Try the questions first, then open the answer. PDFs are there too if you like to practise offline.
Start here: set up your practice table
All sets use the same employees table. Create it and insert the data once, then follow the topics below.
Top 9 most asked interview queries
A short study note with the nine queries interviewers ask most.
Create and add data
Build the table you will practise on.
CREATE command
Create a database and a table
INSERT command
Add rows to a table
Read and filter
Ask the table questions: pick columns, filter, sort and limit.
SELECT command
Read columns from a table
WHERE clause
Filter rows with conditions and operators
AND, OR and NOT
Combine several conditions
BETWEEN and IN
Ranges and lists of values
LIKE and wildcards
Pattern matching with % and _
IS NULL and IS NOT NULL
Find missing values
ORDER BY clause
Sort the result
LIMIT and OFFSET
Return only some rows (MySQL, PostgreSQL)
TOP and FETCH FIRST
The same idea in SQL Server and Oracle
Summarise data
Count, total and average, per group.
Aggregate functions
COUNT, SUM, AVG, MIN and MAX
GROUP BY clause
One result row per group
HAVING clause
Filter groups after GROUP BY
Functions
Built-in helpers for text, numbers and dates.
String functions
Work with text
Numeric functions
Round, absolute value and more
Date and time functions
Work with dates and times
Combine tables and results
Joins and set operators.
Set operators
Combine the results of two queries
INNER and NATURAL JOIN
Combine rows from two tables
Change data and tables
Update rows, alter tables, delete safely.
UPDATE command
Change existing rows
ALTER command
Change a table's structure
DELETE, DROP and TRUNCATE
Remove rows or whole tables
Next level
Window functions come up in almost every senior interview.
Window functions
ROW_NUMBER and friends
No practice set matches that search. Try a shorter word.
Done with the basics?
The PDF kits go further: real MNC and Big Tech questions with the traps interviewers hide in them.
