SQL Joins
Understand INNER, LEFT, RIGHT, and FULL joins with interactive Venn diagrams and a live SQL sandbox.
Category: Databases
·
v1.0.0
Step 1 of 6
Step 1: Why Joins?
In well-designed databases, data is split across multiple tables to avoid repetition. This principle is called normalization. Instead of storing the department name on every employee row, we store a dept_id that references a separate departments table.
SQL JOINs let us combine these tables back together when we need the full picture. Here are our two sample tables:
employees
| id | name | dept_id |
|---|
departments
| id | dept_name |
|---|
Notice that Alice has dept_id = 1, which corresponds to "Engineering" in the departments table. Frank has dept_id = NULL — he hasn't been assigned yet. And there's a "Legal" department (id 5) with no employees. Joins let us combine these tables in different ways.
About This Lab
SQL Joins are essential for combining data from multiple tables. In this lab, you'll visualize how different join types work using Venn diagrams, practice writing join queries against sample data, understand join conditions, and learn when to use each join type.
How It Works
- Read each step's explanation of join concepts
- Interact with the Venn diagrams and data tables
- Write SQL queries in the editor
- See results update in real time
- Complete the quiz to test your knowledge