Skip to content
C

Composite Attribute


Composite Attribute

Definition

A composite attribute is an attribute that can be divided into smaller, meaningful sub-parts, each of which is itself a simple attribute (and independently useful to the application). In ER diagrams, a composite attribute is shown as an oval connected to further ovals representing its component simple attributes.

Worked Example

In the college database, Address is a classic composite attribute for Student: it decomposes into Street, City, State, and Pincode. Another example: Name could be modeled as composite, splitting into FirstName and LastName, if the application needs to sort by last name or greet students by first name specifically. The overall composite value ("221B, MG Road, Pune, Maharashtra, 411001") is still meaningful as a whole, but each component is also independently queryable.

Edge Cases

  • A composite attribute's components can themselves, in principle, be further decomposed (though this is rare in practice) — but the immediate children of a composite attribute in the ER model are simple attributes.
  • Composite attributes are a purely conceptual/design convenience. In ER-to-relational mapping (6.21), a composite attribute is typically "flattened": each component becomes its own column in the table (e.g., Street, City, State, Pincode as four separate columns), and the composite grouping itself disappears at the physical/table level.
  • Do not confuse composite attribute with multi-valued attribute: Address has ONE set of sub-parts per student (composite, but still single-valued as a whole) — it is not that a student has multiple addresses. If a student could have multiple addresses (e.g., permanent and current), that would additionally make Address multi-valued, a distinct and combinable property.
  • A composite attribute should only be used when the sub-parts are genuinely needed independently; over-decomposing attributes that will never be queried separately adds needless design complexity.

Key Takeaways / Interview Q&A

Q: How is a composite attribute drawn in an ER diagram? A: As an oval for the composite attribute (e.g., Address), connected by lines to smaller ovals for each component simple attribute (Street, City, State, Pincode).

Q: What happens to a composite attribute when converting the ER diagram to relational tables? A: It is decomposed into its individual simple-attribute components, each becoming a separate column; the "composite" grouping is a diagram-level concept only, not a stored structure.

Q: Is a composite attribute the same as a multi-valued attribute? A: No. Composite refers to internal structure (one value with sub-parts); multi-valued refers to how many values of that attribute an entity can have. An attribute can be composite and single-valued, composite and multi-valued, simple and single-valued, or simple and multi-valued — all four combinations are possible.

Mock Test

  • Composite Attribute - Quick Test

    8 questions on Composite Attribute.

    8 questions · 8 min · Medium
    Start Mock Test