Several Views on How to Teach JOINs

Teachers and tutorial writers explain JOINs in very different ways, and each way helps some learners more than others. This page lays out four common approaches side by side. They are composite viewpoints, not opinions of named people.

Database performance basics illustration

View 1: use Venn diagrams

The idea: draw two overlapping circles, one for each table. An inner join is the overlap; a left join is the whole left circle plus the overlap.

Why people like it: quick to draw, easy to remember, shows which rows are "kept".

The criticism: circles suggest each row appears once, but joins can produce many rows for one row when there are several matches. Learners may be surprised by duplicates.

View 2: match rows by hand

The idea: take two tiny tables, three or four rows each, and write out the result row by row, drawing lines between matching rows.

studentsenrolments
idnamestudent_idcourse
1Ana1Maths
2Ben1Art
3Cy3Music

Matching by hand shows that Ana appears twice (two courses), Cy once, and Ben not at all in an inner join.

Why people like it: it shows exactly what the database does, including duplicates and missing rows.

The criticism: it takes longer, and some learners find it tedious.

View 3: explain it as a loop in code

The idea: for learners who already program, show the join as nested loops:

for s in students:
    for e in enrolments:
        if e.student_id == s.id:
            print(s.name, e.course)

Why people like it: it connects SQL to something programmers already understand.

The criticism: it can suggest the database always works this way, when real databases use cleverer methods. It also does not help learners who are not programmers yet.

View 4: start from a question

The idea: begin with a real question, such as "which students take Maths?", show that the answer needs data from two tables, and introduce JOIN as the tool for combining them.

Why people like it: it gives a reason to learn joins before the mechanics.

The criticism: without one of the other views, learners may copy the pattern without understanding it.

Side by side

ApproachShows duplicates clearlySpeed to explainBest for
Venn diagramsNoFastA first rough idea
Matching rows by handYesSlowReal understanding
Loops in codeYesMediumLearners who already program
Starting from a questionDependsMediumMotivation

Where these views agree

Most teachers end up combining approaches: a question to motivate, tiny tables matched by hand to understand, and perhaps a diagram as a reminder. They also agree that LEFT JOIN deserves extra time, because learners often lose rows without noticing.

Try the hands-on approach

Our INNER JOIN and LEFT JOIN tutorial uses tiny tables you can match by hand, and several reader questions about JOINs cover the surprises that follow.

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.

Illustrative outline only: no live session, recording, registration or certificate is offered on this site. Any speakers, panels or schedules mentioned are hypothetical.

Related pages on this site