Relationships define how tables interact in a relational database. Properly designed relationships enforce data integrity and simplify queries.
- One‑to‑One: Each row in Table A relates to a single row in Table B.
- One‑to‑Many: A row in Table A can relate to many rows in Table B.
- Many‑to‑Many: Rows in Table A can relate to multiple rows in Table B and vice‑versa, typically implemented via a junction table.
Use FOREIGN KEY
constraints to enforce relationships.