SQL Join Playground — Build a Query, Watch the Result
Pick two or three tables, choose a join type, then tick any
combination of conditions — course (subject), date, and
period_no — which are combined with AND automatically. Choose
whether they go in WHERE (present students only) or in the
JOIN ... ON clause (which keeps absentees as NULL with a Present/Absent column).
The matching SQL and the resulting rows update live, with the join links animating between the
tables you select.
All three tables share roll_no. Every join below matches rows on
roll_no. Watch what happens to Esha (no attendance),
roll 106 (attendance but no student), and roll 107
(activity but no student) as you switch between INNER and OUTER joins.
👤 students
| roll_no | name | branch |
|---|---|---|
| 101 | Asha | CSE |
| 102 | Bilal | CSE |
| 103 | Chen | ECE |
| 104 | Diya | ME |
| 105 | Esha | ECE |
📋 attendance
| roll_no | course | date | period_no |
|---|---|---|---|
| 101 | DBMS | 2024-03-01 | 1 |
| 101 | OS | 2024-03-01 | 2 |
| 102 | DBMS | 2024-03-01 | 1 |
| 103 | DBMS | 2024-03-02 | 3 |
| 104 | OS | 2024-03-02 | 2 |
| 106 | DBMS | 2024-03-01 | 1 |
Note: roll 106 has attendance but no matching student row.
🎯 activities (extra-curricular)
| roll_no | activity | role |
|---|---|---|
| 101 | Robotics | Lead |
| 102 | Coding Club | Member |
| 103 | Music | Member |
| 105 | Sports | Captain |
| 107 | Drama | Member |
Note: roll 107 has an activity but no matching student row.
Switch students + attendance from INNER to LEFT — Esha appears with
NULL course. Switch to RIGHT — roll 106 appears with no name. Add
WHERE course = 'DBMS' on a LEFT join and notice the NULL rows vanish: a WHERE
filter on an outer-joined column silently turns it back into an inner result.
To answer "who was absent for DBMS on 2024-03-01, period 1?" the condition must go in the JOIN ... ON clause, not WHERE. In Step 3, switch "Apply conditions in" to JOIN ON and pick LEFT JOIN: every student is kept, the attendance columns fill in for those who attended that exact session, and everyone else shows Absent with NULL attendance. The same condition in WHERE deletes those NULL rows, so the absentees disappear — which is the situation you were running into.