SQL Quiz: 12 MySQL Questions
This free SQL quiz checks the database skills every web developer needs: writing SELECT queries with WHERE and ORDER BY, join types, GROUP BY and HAVING, NULL handling, indexes, primary and foreign keys, normalisation, transactions and ACID, DELETE versus TRUNCATE and preventing SQL injection. Questions use MySQL behaviour. Answer all 12 questions, check your score, then read the explanations and revisit the MySQL guide for anything you got wrong.
Frequently asked questions
Is this quiz only for MySQL?
Most questions apply to any SQL database. Where behaviour differs, such as TRUNCATE and AUTO_INCREMENT, the quiz follows MySQL with the InnoDB engine.
Where can I practise these queries?
Install MySQL or MariaDB locally (for example through XAMPP), create a small students or orders table and run the queries yourself.
Why is SQL injection in a SQL quiz?
Because it comes from how application code builds queries. Using prepared statements is part of writing SQL safely.