Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 52 additions & 58 deletions 03_Joins/README.md
Original file line number Diff line number Diff line change
@@ -1,61 +1,55 @@
# SQL Joins

## Overview

SQL Joins are used to combine data from multiple tables using a related column.

In real-world analytics, data is rarely stored in a single table. Joins allow analysts to connect datasets and answer business questions.

# 03 β€” SQL Joins

> **Module 3 of the SQL Engineering Handbook**
> Real-world data never lives in one table. This module teaches you to connect it.

[![Level](https://img.shields.io/badge/Level-Beginner%20%E2%86%92%20Intermediate-yellow)]()
[![Estimated Time](https://img.shields.io/badge/Time-3--4%20hrs-blue)]()
[![Topics](https://img.shields.io/badge/Topics-5-orange)]()
[![Interview Critical](https://img.shields.io/badge/Interview-Critical-red)]()
[![Status](https://img.shields.io/badge/Status-Complete-success)]()

---

## Topics Covered

### Beginner

- INNER JOIN
- LEFT JOIN
- RIGHT JOIN

### Intermediate

- SELF JOIN

---

## Schema Used

employees
β”‚
β–Ό
departments
β”‚
β–Ό
locations


## πŸ“‘ Table of Contents

- [Overview](#-overview)
- [Topics Covered](#-topics-covered)
- [Folder Structure](#-folder-structure)
- [Recommended Learning Order](#-recommended-learning-order)
- [Schema Used](#-schema-used)
- [How Joins Actually Work](how-joins-actually-work)
- [Skills Developed](#-skills-developed)
- [Business Applications](#-business-applications)
- [Interview Importance](#-interview-importance)
- [Best Practices](#-best-practices)
- [Prerequisites](#-prerequisites)
- [How to Use This Module](#-how-to-use-this-module)
- [Next Section](#-next-section)
---

## Business Applications

- Employee reporting
- Department analysis
- Workforce planning
- Location-based analytics
- Manager hierarchy analysis

## πŸ”Ž Overview
SQL **joins** are used to combine data from multiple tables using a related column.
In real-world systems, data is normalized and spread across many tables β€” employees in one table, departments in another, locations in a third. Joins are what let you reconnect that data and ask questions that span across it, like *"which employees work in which locations, under which managers?"*
This is the module where SQL stops being about *one table* and starts being about *your entire database*.
---

## Skills Developed

- Combining tables
- Understanding relationships
- Foreign key usage
- Multi-table querying
- Hierarchical analysis

---

## Interview Importance

Joins are among the most frequently asked SQL interview topics.

A strong understanding of joins is essential for Data Analyst and Data Scientist roles.
## πŸ“– Topics Covered
### Beginner
| No. | Topic | Description | Files |
|----|-------|--------------|-------|
| 01 | **INNER JOIN** | Return only matching rows from both tables | [`01_INNER_JOIN.md`](./01_INNER_JOIN.md) Β· [`01_INNER_JOIN.sql`](./01_INNER_JOIN.sql) |
| 02 | **LEFT JOIN** | Return all rows from the left table, matched or not | [`02_LEFT_JOIN.md`](./02_LEFT_JOIN.md) Β· [`02_LEFT_JOIN.sql`](./02_LEFT_JOIN.sql) |
| 03 | **RIGHT JOIN** | Return all rows from the right table, matched or not | [`03_RIGHT_JOIN.md`](./03_RIGHT_JOIN.md) Β· [`03_RIGHT_JOIN.sql`](./03_RIGHT_JOIN.sql) |
### Intermediate
| No. | Topic | Description | Files |
|----|-------|--------------|-------|
| 04 | **SELF JOIN** | Join a table to itself β€” used for hierarchies | [`04_SELF_JOIN.md`](./04_SELF_JOIN.md) Β· [`04_SELF_JOIN.sql`](./04_SELF_JOIN.sql) |