PUBLIC ACTIVITY · v1.0.0
LEFT, RIGHT, INNER, CROSS JOIN... WHAT?
An Interactive SQL JOIN Laboratory
Change the JOIN. Compare the records. Select a result row to discover why it appears.
Choose a JOIN
Examine the sources
Select a employee_id or space_id to inspect.
Source records and their participation
| employee_id PK | first_name | Participation |
|---|
| space_id PK | employee_id FK | Participation |
|---|
• Matched + Kept without match − Excluded
Outline follows the current selection. × marks a CROSS pairing.
Why are unassigned spaces valid?
Read the result
| TRACE | EMPLOYEE · LEFT | PARKING_SPACE · RIGHT | ||
|---|---|---|---|---|
| employee_id | first_name | space_id | space_employee_id | |
Scroll the table sideways to see all attributes.
Select a numbered row to explain it below.
How are these rows ordered?
Every result is sorted by employee_id, then space_id, with NULLs last in each field. The SQL uses the same explicit ORDER BY. A JOIN alone does not guarantee row order.
Examine the SQL
Calculated locally from the source records. This statement illustrates MySQL syntax; no database server is running.
EXAPTER ENDAPTER · WORKING ARTIFACT Public version · v1.0.0
Modeling assumptions & notes
These fictional instructional records illustrate introductory MySQL JOIN concepts. JOIN operations are calculated locally in your browser from the four records in each active source table. No database server is running.
In Employees & Parking Spaces, each table has a unique, non-NULL primary key. PARKING_SPACE.employee_id is a nullable, UNIQUE foreign key: an assigned space references an existing employee, an employee has at most one assigned space, and multiple unassigned spaces may store NULL.
In Customers & Orders, each table has a unique, non-NULL primary key. ORDERS.customer_id is a NOT NULL foreign key referencing an existing customer. A customer may have zero or multiple orders. These are explicit business rules, rather than conclusions drawn only from sample patterns.
Stored NULL means an unassigned parking space in these examples. Outer JOINs can also introduce NULL fields for a missing source row; the result and row trace distinguish those origins. CROSS JOIN produces all combinations without an equality condition and creates no assignments or orders.
Source-table pop-outs show seven fictional illustrative records per table, including additional attributes and records beyond the smaller active JOIN datasets. Those expanded views never enter the active JOIN calculation.
The downloaded activity runs offline when kept with its companion CSS and JavaScript files. The activity includes no analytics, tracking scripts, account, submission, cookies, or persistent browser storage; selections last until reload. Copy SQL writes to your clipboard when requested. Institutional links open external sites, and the hosting provider may log page requests. The social-preview image is hosted by Working Artifact.