Lecture 1: Join Overview
🎯 Learning Objectives
By the end of this lecture, you will be able to:
- Define the JOIN operator.
- Explain the role of primary keys and foreign keys in a JOIN operation.
- Identify the different types of JOIN operators in SQL.
🧠 Concept Overview
A simple SELECT statement retrieves data from one or more columns of a single table.
However, in real-world databases, data is often spread across multiple related tables.
To retrieve connected information from these tables, we use the JOIN operator.
🔗 What is a JOIN?
- A JOIN combines rows from two or more tables based on a relationship between specific columns in those tables.
- These relationships are usually established through primary keys and foreign keys.
📘 Example (Library Database Model)
In a simplified library system:
- Entities include Author, Book, Borrower, Loan, and Copy.
- Each entity is represented by a separate table.