Compound Attributes in Databases: Structure, Example, and Benefits

A compound attribute (composite attribute) is a single logical attribute composed of multiple atomic sub-attributes.

Classic Example: Employee Address

EmployeeAddress (compound)
├── StreetAddress
├── City
├── State
├── ZIPCode
└── Country (optional)

Benefits

  • Logical grouping: Related data stays together.
  • Atomic access: Queries can reference whole (EmployeeAddress) or parts (City).
  • Schema clarity: Reduces table sprawl vs. separate address table for 1:1.
  • Integrity: Constraints on composite (e.g., ZIP matches City/State).

Implementation

  • Relational: Embedded columns (Address_Street, Address_City…) or UDT (PostgreSQL, Oracle).
  • Document/NoSQL: Native nested object.
  • ORM: Embedded/value object (JPA @Embeddable, EF Core Owned Entity).

When to Decompose

If sub-attributes are shared (many employees per address), queried independently, or have independent lifecycle → separate entity/table.

Nutritional Supplements - Related Articles