Beginner

583. One-to-One JOIN

Understand JOINs between tables where each record has at most one related record.

📘 Lesson 583 of 728 ⏱ 12 min 🎯 Intermediate

A one-to-one relationship occurs when each row in one table corresponds to at most one row in another table. A JOIN between such tables normally produces one combined row per entity.

Understanding relationship cardinality helps predict JOIN results and avoid unexpected duplicates.

Join Employees with EmployeeDetails where each employee has one detail record.

SQL
SELECT
    e.EmployeeID,
    e.EmployeeName,
    d.Email,
    d.Phone
FROM Employees e
INNER JOIN EmployeeDetails d
    ON e.EmployeeID = d.EmployeeID;

Used in normalized database designs, employee systems, customer profiles, and master-detail structures.

  • One row matches at most one related row.
  • Primary and unique keys commonly support the relationship.
  • Unexpected duplicates may indicate data-quality issues.
  • One-to-one relationships can split information across tables.
  • JOIN output is usually predictable.
What is a one-to-one relationship?

It is a relationship where each record in one table corresponds to at most one record in another table.

Why is cardinality important in JOINs?

It helps predict how many rows the JOIN can produce and whether duplicate results are expected.

Have you finished this lesson?

Introduction to SQL – All Lessons