RelationalDBDesign RelationalDBDesign


ER Diagrams   «Prev  Next»

Lesson 4One-to-one relationships, part 1
ObjectiveDefine 1:1 relationships and show when and how to implement them.

One-to-One Relationships in ER Modeling

A one-to-one (1:1) relationship links at most one instance of entity A with at most one instance of entity B—and vice versa. True 1:1 is less common than 1:N, but it’s valuable for:

Key characteristics

  1. Uniqueness on both sides: Each row in A relates to at most one row in B, and each row in B relates to at most one row in A.
  2. Primary key usage: Implement via a shared primary key (PK in B = PK in A and FK to A) or via a unique foreign key (FK in B is UNIQUE).
  3. Optionality: Either side may be optional (0..1). Model this with a nullable FK; mandatory participation uses NOT NULL.

How 1:1 Looks in Diagrams

1) 1:1 relationship from the viewpoint of Table A (A ↔ B).
From A’s viewpoint: one row in Table A relates to one row in Table B (A:B = 1:1).
2) The same 1:1 relationship from Table B’s viewpoint (B ↔ A).
From B’s viewpoint: one row in Table B relates to one row in Table A (B:A = 1:1).

Implementation Patterns

Choose one based on ownership, optionality, and access patterns.

Where to put the FK?

Real-World Use Cases

  1. User & Authentication: User(UserID)UserAuth(UserID, PasswordHash, MFA...) (privacy, audit).
  2. Employee & HR Profile: Split confidential compensation/benefits from general HR data.
  3. Entity & Settings: Optional per-entity configuration without polluting the base table with many nullable columns.
  4. Document & Blob: Keep large LOBs in a companion table to avoid bloating the hot row.

Connectivity and Cardinality Notes

Connectivity indicates one or many per side; 1:1 means “one” on both sides. The cardinality (actual counts) can vary by instance, but constraints enforce the upper bound. Optionality (0 or 1) is modeled via nullable FKs; mandatory (1) via NOT NULL plus referential integrity.

Be careful not to model a disguised 1:N as 1:1. If, over time, multiple B rows per A appear, your 1:1 will be violated—check business rules and sample data.

The next lesson continues with additional 1:1 design nuances and edge cases.


SEMrush Software 4 SEMrush Banner 4