DBMS 📂 SQL · 4 of 6 23 min read

Interactive SQL Join Playground — Build Queries with WHERE & AND, See Live Results

A hands-on, no-backend SQL join simulator you embed directly in a web page. Learners select two or three related tables (students, attendance, activities — all keyed on roll_no), pick a join type (INNER, LEFT, RIGHT, FULL OUTER), and optionally layer WHERE and AND filters on course, date, and period_no. The matching SQL statement and the resulting rows render live and animated, with NULLs shown explicitly so the difference between inner and outer joins

Interactive Lab

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.

🧮
How the Join Key Works Here

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_nonamebranch
101AshaCSE
102BilalCSE
103ChenECE
104DiyaME
105EshaECE

📋 attendance

roll_nocoursedateperiod_no
101DBMS2024-03-011
101OS2024-03-012
102DBMS2024-03-011
103DBMS2024-03-023
104OS2024-03-022
106DBMS2024-03-011

Note: roll 106 has attendance but no matching student row.

🎯 activities (extra-curricular)

roll_noactivityrole
101RoboticsLead
102Coding ClubMember
103MusicMember
105SportsCaptain
107DramaMember

Note: roll 107 has an activity but no matching student row.

🔗 Live Schema — selected tables & active join links
students roll_no · name · branch attendance course · date · period activities activity · role joined on roll_no
💡
Things to Try

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.

🏫
Seeing Absent Students — WHERE vs JOIN ... ON

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.