What Education Research Says About Learning SQL

If SQL feels strange at first, you are in good company. Teachers and researchers who study how people learn programming have looked closely at SQL, and their findings are reassuring: the same few stumbling blocks come up again and again, and there are known ways past them.

Where this research comes from

Most of it is computing education research: studies by teachers and university researchers who watch students learn, collect their answers to exercises, and look for patterns. You will find this work at conferences such as SIGCSE (the ACM special interest group on computer science education) and ITiCSE, and in journals about teaching computing. We describe the type of findings here rather than quoting numbers, because results depend a lot on who was studied and how.

What beginners commonly find hard

Studies of student answers tend to point to the same handful of difficulties:

  1. Thinking in sets, not steps. Most people learn programming as a list of instructions. SQL asks you to describe *what* you want, and the database decides *how* to get it. That switch takes time.
  2. JOINs. Choosing the right join, and understanding why rows disappear with an inner join, is a frequent source of wrong answers.
  3. GROUP BY. Beginners often select a column that is neither grouped nor inside a function such as COUNT, and get an error or a confusing result.
  4. NULL. The idea that NULL means "unknown", so = NULL is never true, surprises almost everyone.
  5. Small syntax slips. Missing commas, quotes around numbers, or a misspelled column name. These are easy to fix but discouraging.

What seems to help

Researchers and teachers report that some approaches make a real difference:

What this means for you

If you struggle with...Try this
Not knowing where to startWrite SELECT * FROM the table and look at it first
JOINsDraw the two tables and match rows by hand for three or four rows
GROUP BY errorsMake sure every selected column is grouped or counted
NULLUse IS NULL and IS NOT NULL, never = NULL

A word of caution

One study of one class does not prove a rule for everyone. Learners differ, and so do courses. Treat these findings as a map of common bumps in the road, not as a verdict on how fast you should learn. If you want to read the research yourself, search the ACM Digital Library for terms such as "SQL misconceptions" or "learning SQL errors".

Our beginner course on SELECT queries is built around the "small steps" idea described above.

A free learning page for beginners. Practise on a test database, never on real customer data, and check the official documentation for your database version.

General commentary only: this page does not report specific news events and does not cite a survey or data source. Treat any trends described as unverified.