Module 02
Multiple-Table Joins
Combine rows from multiple tables using matching columns to extract unified analytical data insights.
📋 Source Datasets (4 Sample Records)
TABLE 1: employees
| emp_id | name | project_id |
|---|---|---|
| 101 | Amit Sharma | P1 |
| 102 | Rohan Verma | P2 |
| 103 | Neha Gupta | P1 |
| 104 | Vikram Singh | NULL |
TABLE 2: projects
| project_id | project_name |
|---|---|
| P1 | Cloud Migration |
| P2 | AI Chatbot |
| P3 | Data Pipeline |
| P4 | Web Portal |
1. INNER JOIN
Definition: Returns rows only when there is a matching value in both tables.
SELECT e.name, p.project_name FROM employees e INNER JOIN projects p ON e.project_id = p.project_id;
| name | project_name |
|---|---|
| Amit Sharma | Cloud Migration |
| Rohan Verma | AI Chatbot |
| Neha Gupta | Cloud Migration |
2. LEFT JOIN
Definition: Returns all rows from left table, and matching rows from right table with NULLs for misses.
SELECT e.name, p.project_name FROM employees e LEFT JOIN projects p ON e.project_id = p.project_id;
| name | project_name |
|---|---|
| Amit Sharma | Cloud Migration |
| Rohan Verma | AI Chatbot |
| Neha Gupta | Cloud Migration |
| Vikram Singh | NULL |
3. RIGHT JOIN
Definition: Returns all rows from right table, and matching values from the left table.
SELECT e.name, p.project_name FROM employees e RIGHT JOIN projects p ON e.project_id = p.project_id;
| name | project_name |
|---|---|
| Amit Sharma | Cloud Migration |
| Neha Gupta | Cloud Migration |
| Rohan Verma | AI Chatbot |
| NULL | Data Pipeline |
| NULL | Web Portal |
4. CROSS JOIN
Definition: Produces a complete Cartesian product grid pairing every single item from both tables.
SELECT e.name, p.project_name FROM employees e CROSS JOIN projects p;
| name | project_name |
|---|---|
| Amit Sharma | Cloud Migration |
| Amit Sharma | AI Chatbot |
| ...and so on | ...Total 16 Pairs |
Unlock Real Corporate Scenario Interactive Sandboxes
Basic structures are covered! To clear FAANG, MAANG & top analytical enterprise interviews, buy the complete pack to get 150+ interactive practice question sheets, video explanation keys, and real production datasets.