0
0
DbmsHow-ToBeginner ยท 4 min read

Types of Attributes in ER Diagram: Explained with Examples

In an ER diagram, attributes describe properties of entities and can be of various types: simple (indivisible), composite (made of multiple parts), derived (calculated from other attributes), single-valued (one value per entity), and multi-valued (multiple values per entity). These types help model real-world data clearly and precisely.
๐Ÿ“

Syntax

Attributes in an ER diagram are represented as ovals connected to their entity or relationship. Different types of attributes have distinct representations:

  • Simple Attribute: A single oval with the attribute name.
  • Composite Attribute: An oval connected to smaller ovals representing its parts.
  • Derived Attribute: An oval with a dashed outline.
  • Multi-valued Attribute: A double oval.
  • Key Attribute: An oval with the attribute name underlined to show it uniquely identifies an entity.
plaintext
Entity: Student
Simple Attribute: Name
Composite Attribute: FullName (FirstName, LastName)
Derived Attribute: Age (from DateOfBirth)
Multi-valued Attribute: PhoneNumbers
Key Attribute: StudentID
๐Ÿ’ป

Example

This example shows how different attribute types describe a Student entity:

plaintext
Entity: Student
Attributes:
- StudentID (Key, Single-valued)
- FullName (Composite: FirstName, LastName)
- DateOfBirth (Simple)
- Age (Derived from DateOfBirth)
- PhoneNumbers (Multi-valued)

Representation:
Student --(oval)--> StudentID (underlined)
Student --(oval)--> FullName --(ovals)--> FirstName, LastName
Student --(oval)--> DateOfBirth
Student --(dashed oval)--> Age
Student --(double oval)--> PhoneNumbers
Output
Student entity with attributes: - StudentID (unique ID) - FullName split into FirstName and LastName - DateOfBirth as a simple attribute - Age calculated from DateOfBirth - Multiple PhoneNumbers stored
โš ๏ธ

Common Pitfalls

Common mistakes when using attributes in ER diagrams include:

  • Confusing composite and simple attributes by not breaking down composite attributes into parts.
  • Forgetting to mark key attributes as underlined, which can cause ambiguity in entity identification.
  • Not using derived attributes properly, leading to redundant data storage.
  • Ignoring multi-valued attributes and trying to store multiple values in a single attribute, which breaks normalization.
plaintext
Wrong:
Entity: Employee
Attribute: FullName (treated as simple)

Right:
Entity: Employee
Attribute: FullName (Composite: FirstName, LastName)
๐Ÿ“Š

Quick Reference

Attribute TypeDescriptionER Diagram Symbol
SimpleIndivisible attribute with a single valueSingle oval
CompositeAttribute made of multiple sub-partsOval connected to smaller ovals
DerivedAttribute calculated from other attributesDashed oval
Multi-valuedAttribute with multiple values per entityDouble oval
KeyAttribute that uniquely identifies an entityUnderlined oval
โœ…

Key Takeaways

Attributes describe properties of entities and relationships in ER diagrams.
Simple, composite, derived, multi-valued, and key are the main attribute types.
Composite attributes break down into smaller parts for clarity.
Derived attributes are calculated, not stored directly.
Multi-valued attributes represent multiple values and use double ovals.