ER Data Model (Entity-Relationship Model)
The Entity-Relationship (ER) Model is a conceptual data model used to design and structure
a database at a high level. It helps to visually represent the entities, attributes, and
relationships within a database. This model is widely used during the initial stages of
database design to capture and analyze requirements from a business perspective.
Key Components of the ER Model
1. Entities
• Represent real-world objects or concepts that can have data stored about them
in the database.
• Types of Entities:
• Strong Entity: Can exist independently of other entities. For example,
Student or Course.
• Weak Entity: Depends on a strong entity for its existence. For example,
Dependent (related to Employee).
2. Attributes
• Describe the properties or characteristics of an entity or relationship.
• Types of Attributes:
• Simple Attribute: Cannot be divided further (e.g., Name, Age).
• Composite Attribute: Can be divided into smaller sub-parts (e.g., Full
Name can be divided into First Name and Last Name).
• Derived Attribute: Can be calculated from other attributes (e.g., Age can
be derived from Date of Birth).
• Multivalued Attribute: Can have multiple values for a single entity (e.g.,
Phone Numbers).
• Key Attribute: A unique identifier for an entity (e.g., Student_ID).
3. Relationships
• Represent the association between two or more entities.
• Types of Relationships:
• One-to-One (1:1): One entity instance is related to one instance of
another entity (e.g., a Person has one Passport).
• One-to-Many (1:N): One entity instance is related to multiple instances of
another entity (e.g., a Teacher teaches many Students).
• Many-to-One(N:1):
• Many-to-Many (M:N): Many instances of one entity are related to many
instances of another entity (e.g., Students enroll in multiple Courses).
4. Relationship Attributes / Mapping Attributes / Mapping Constant
• Attributes specific to a relationship, rather than individual entities.
• Example: In a Borrow relationship between Student and Library Book, the
attribute Borrow_Date belongs to the relationship.
ER Diagram
The ER Model is typically represented as an ER Diagram, a graphical representation that
illustrates:
• Entities: Represented as rectangles.
• Attributes: Represented as ovals connected to entities or relationships.
• Relationships: Represented as diamonds connecting entities.
Example: ER Diagram for a Library Management System
Entities:
1. Book: Attributes: Book_ID, Title, Author
2. Member: Attributes: Member_ID, Name, Membership_Date
3. Loan: Attributes: Loan_Date, Return_Date
Relationships:
• Borrow: A Member borrows a Book.
ER Diagram Representation
[Member] ---- (Borrow) ---- [Book]
| |
[Member_ID] [Book_ID]
• Member has attributes like Member_ID and Name.
• Book has attributes like Book_ID and Title.
• The relationship Borrow includes additional attributes like Loan_Date.
Advantages of ER Model
1. Clear Visualization: Provides an intuitive and visual representation of data
requirements.
2. Flexibility: Can be easily translated into a relational schema.
3. Focus on Relationships: Emphasizes the relationships between entities, aiding in
normalization.
4. Conceptual Simplicity: Easy to understand for stakeholders.