What does this return?
SELECT COUNT(*)FROM employees;
What this SQL test measures, in short
This test checks whether you can predict what a query returns: how NULL behaves, how joins keep or drop rows, what GROUP BY and HAVING do, and how window functions rank. It rewards understanding over memorising syntax.
Queries use standard SQL that runs the same in PostgreSQL, MySQL, SQL Server and SQLite, except where a question is about a difference between them. The questions are our own and not standardised against a population.
By What's Your IQ · Reviewed 4 Oct 2026- Format
- 15 predict-the-result queries, 4 options each
- Topics
- Basics, NULLs, joins, grouping, sorting and window functions
- Data
- 5 employees, 3 departments; 1 missing department, 1 missing salary
- Language
- Developed at IBM in the 1970s; ANSI standard since 1986
SELECT happens almost last
The database logically starts with FROM and works down. That's why WHERE can't see an alias made in SELECT (question 15), and why HAVING exists at all. Step through and watch the rows change.
A join is a decision about who gets left out
SELECT e.name, d.nameFROM employees eINNER JOIN departments d ON e.dept_id = d.id;
Only rows with a match on both sides. Di (no department) and Legal (no employees) are both lost, often without anyone noticing.
- Codd, E. F. (1970). A relational model of data for large shared data banks. Communications of the ACM, 13(6), 377–387.
- Chamberlin, D. D., & Boyce, R. F. (1974). SEQUEL: A structured English query language. Proceedings of the 1974 ACM SIGFIDET Workshop, 249–264.
- ISO/IEC 9075. Information technology — Database languages — SQL.
- Stack Overflow. (2024). 2024 Developer Survey: Technology.