ScholarQuill logoScholarQuillUniversity Notes
My Semester
Explore Notes
Past Papers12 New
Video CoursesNew
Search
Settings
Study Tools
GPA/CGPA Calculator
Schedule & To-Do
Student Portal
Contact
Contact
ScholarQuill logo
My Semester
Explore Notes
Past Papers12 New
Video CoursesNew
Search
Settings
GPA/CGPA Calculator
Schedule & To-Do
Student Portal
Contact
ScholarQuill logoScholarQuillUniversity Notes
Study PortalCC-215Entity Relationship Mo…
Ctrl + K
Login
Explore
Search
Semester
Papers
CGPA
    CC-215

    Database Systems

    Progress0 / 34 done
    Topics34
    1Basic Database Concepts2Database Approach vs File Based System3Database Architecture4Three Level Schema Architecture5Data Independence6Relational Data Model7Attributes8Schemas9Tuples10Domains11Relation Instances12Keys of Relations13Integrity Constraints14Relational Algebra15Selection in Relational Algebra16Projection in Relational Algebra17Cartesian Product in Relational Algebra18Types of Joins19Normalization20Functional Dependencies21Normal Forms22Entity-Relationship Model23Entity Sets24Attributes in Entity-Relationship Model25Relationship in Entity-Relationship Model26Entity-Relationship Diagrams27Structured Query Language (SQL)28Joins in SQL29Sub-Queries in SQL30Grouping and Aggregation in SQL31Concurrency Control32Database Backup and Recovery33Indexes34NoSQL Systems
    7 min read
    Topic 22 of 34
    Topic Study Note Illustration
    22

    Entity-Relationship Model

    The Entity-Relationship (ER) Model is a conceptual framework used in database design to visually represent the structure of a database and the relationships between data entities. The...

    Entity-Relationship Model (ER Model)

    The Entity-Relationship (ER) Model is a conceptual framework used in database design to visually represent the structure of a database and the relationships between data entities. The ER model is widely used for database design because it helps in visualizing data requirements and forming a blueprint for creating a relational database.

    The ER model uses entities, attributes, and relationships to describe the data requirements of a system.


    Key Components of the ER Model

    1. Entities
      An entity is an object or thing in the real world that has a distinct existence. It represents a set of objects that share the same properties or characteristics. Entities can be physical objects (e.g., a car, an employee, a department) or abstract concepts (e.g., a project, an event).

      • Entity Type: A collection of similar entities that share common attributes.
      • Entity Instance: A specific object or record in an entity set.

      Example:
      An entity set called Employee could include entities such as:

      • EmployeeID: 101, Name: Alice
      • EmployeeID: 102, Name: Bob

      Entity Diagram: Entities are typically represented as rectangles in an ER diagram.

    2. Attributes
      An attribute is a property or characteristic that describes an entity. Attributes represent the data that the system will store for each entity.

      • Simple (Atomic) Attributes: An attribute that cannot be divided further (e.g., Age, EmployeeID).
      • Composite Attributes: An attribute that can be divided into smaller sub-parts (e.g., Full Name could be divided into First Name and Last Name).
      • Derived Attributes: An attribute whose value can be derived from other attributes (e.g., Age derived from Date of Birth).
      • Multi-valued Attributes: An attribute that can have multiple values (e.g., a person’s Phone Numbers).

      Example:
      For the Employee entity, some possible attributes could be:

      • EmployeeID (identifier)
      • Name (composite: First Name, Last Name)
      • DateOfBirth
      • Address

      Attribute Diagram: Attributes are represented as ovals connected to their respective entities.

    3. Relationships
      A relationship represents an association between two or more entities. It shows how entities interact with each other.

      • Relationship Type: A set of associations that share common attributes.
      • Cardinality: Describes how many instances of one entity are associated with instances of another entity in a relationship. Cardinalities include:
        • One-to-One (1:1): Each instance of entity A is associated with one instance of entity B.
        • One-to-Many (1:M): Each instance of entity A can be associated with many instances of entity B.
        • Many-to-Many (M:N): Many instances of entity A can be associated with many instances of entity B.

      Example:

      • A relationship between Employee and Department: An employee works in a department.
      • Cardinality: One-to-Many (One department can have many employees, but each employee works in only one department).

      Relationship Diagram: Relationships are represented by diamonds in an ER diagram. The entities involved are connected to the relationship by lines.

    4. Primary Keys
      A primary key is an attribute or a set of attributes that uniquely identifies each entity instance. It must be unique for every record in the entity set.

      Example:
      For the Employee entity, EmployeeID could be a primary key because it uniquely identifies each employee.

      Primary Key Diagram: The primary key is usually underlined in the ER diagram.

    5. Weak Entities
      A weak entity is an entity that cannot be identified by its own attributes alone. It requires a strong (owner) entity to ensure its uniqueness. A weak entity typically has a partial key and is dependent on the strong entity for identification.

      • Identifying Relationship: The relationship between the weak entity and the strong entity is called an identifying relationship.
      • Weak Entity Representation: Weak entities are typically represented as double rectangles in an ER diagram.

      Example:
      A Dependent entity might be a weak entity in a relationship with an Employee entity, where a dependent cannot be uniquely identified without reference to the employee.


    Types of ER Models

    1. Chen’s Notation:
      This is the traditional form of the ER model introduced by Peter Chen. In Chen's notation:

      • Entities are represented by rectangles.
      • Attributes are represented by ellipses.
      • Relationships are represented by diamonds.
    2. Crow’s Foot Notation:
      This is a more modern and popular variation of the ER model. It uses:

      • Entities represented as rectangles.
      • Attributes represented as ovals or listed inside the entity.
      • Relationships represented by lines, with symbols at the ends indicating the cardinality (crow's feet for "many", a straight line for "one").
    3. UML Notation:
      Unified Modeling Language (UML) can also be used to model databases, using class diagrams to represent entities and relationships.


    Example ER Diagram

    Let's consider an example of a university database that includes students, courses, and instructors:

    Entities:

    • Student: Attributes - StudentID, Name, DOB
    • Course: Attributes - CourseID, CourseName
    • Instructor: Attributes - InstructorID, Name

    Relationships:

    • Enrollment: A relationship between Student and Course (Many-to-Many).
      • Attributes: Grade (Optional, could store a grade received by a student in a course).
    • Teaches: A relationship between Instructor and Course (One-to-Many).
      • Cardinality: One instructor can teach many courses, but a course is taught by one instructor.

    ER Diagram Representation:

    [Student] -----< Enrollment >----- [Course] -----< Teaches >----- [Instructor]
         |                                    |
       [StudentID]                      [CourseID] [InstructorID]
         |                                    |
       [Name]                            [CourseName]   [Name]
    

    ER Model Design Process

    1. Identify Entities:
      Identify all the objects (or things) that need to be represented in the system. These will become the entities in the ER diagram.

    2. Identify Relationships:
      Define how the entities are related to each other. Relationships should capture how entities interact with each other.

    3. Define Attributes:
      Determine what attributes (properties) each entity should have. Attributes describe characteristics of entities.

    4. Define Primary Keys:
      For each entity, choose a primary key that uniquely identifies instances of the entity.

    5. Define Cardinality:
      Determine the nature of relationships between entities (one-to-one, one-to-many, many-to-many).

    6. Normalization:
      Apply normalization rules to ensure the database structure is efficient, removing redundancy and dependency issues.


    Advantages of the ER Model

    • Simplicity: The ER diagram is intuitive and easy to understand for both technical and non-technical stakeholders.
    • Clarity: It provides a clear visual representation of the data model and its relationships, helping to identify inconsistencies or missing requirements.
    • Flexibility: The model can easily be modified as the system evolves.
    • Foundation for Database Implementation: ER diagrams serve as the foundation for translating the design into a physical database schema.

    Limitations of the ER Model

    • Complexity for Large Systems: As the number of entities and relationships increases, ER diagrams can become difficult to manage and interpret.
    • Lack of Procedural Representation: The ER model focuses on data representation and does not specify how the data will be processed.

    Conclusion

    The Entity-Relationship Model (ER Model) is a vital tool in the conceptual design phase of database development. It helps to define the structure of the database by identifying entities, attributes, and relationships and then representing these visually in a diagram. The ER model guides the creation of efficient, logical database designs that are easy to understand and implement.

    ← Previous topic 21
    Normal Forms
    Next topic 23 →
    Entity Sets

    Past Papers

    Open this section to view and download past papers

    Click on Show Past Papers to load available exam papers.

    Reading Progress
    0%
    7mremaining
    1.2kwords
    Intermediatelevel
    On This Page

    No headings found

    Study Toolkit

    Subject Portal

    Database Systems