ScholarQuill logoScholarQuillUniversity Notes
  • Notes
  • Past Papers
  • Blogs
  • Todo
Login
ScholarQuill logoScholarQuillUniversity Notes
Login
NotesPast PapersBlogsTodo
More
SubjectsDiscussionCGPA CalculatorGPA CalculatorStudent PortalCourse Outline
About
About usPrivacy PolicyReportContact
Notes
Past Papers
Blogs
Todo
Analytics
    Current Subject
    🧩
    Database Systems
    CC-215
    Progress0 / 34 topics
    Topics
    1. Basic Database Concepts2. Database Approach vs File Based System3. Database Architecture4. Three Level Schema Architecture5. Data Independence6. Relational Data Model7. Attributes8. Schemas9. Tuples10. Domains11. Relation Instances12. Keys of Relations13. Integrity Constraints14. Relational Algebra15. Selection in Relational Algebra16. Projection in Relational Algebra17. Cartesian Product in Relational Algebra18. Types of Joins19. Normalization20. Functional Dependencies21. Normal Forms22. Entity-Relationship Model23. Entity Sets24. Attributes in Entity-Relationship Model25. Relationship in Entity-Relationship Model26. Entity-Relationship Diagrams27. Structured Query Language (SQL)28. Joins in SQL29. Sub-Queries in SQL30. Grouping and Aggregation in SQL31. Concurrency Control32. Database Backup and Recovery33. Indexes34. NoSQL Systems
    CC-215›Attributes in Entity-Relationship Model
    Database SystemsTopic 24 of 34

    Attributes in Entity-Relationship Model

    5 minread
    849words
    Beginnerlevel

    Attributes in the Entity-Relationship (ER) Model

    In the Entity-Relationship (ER) Model, attributes are the properties or characteristics that describe entities and relationships. They define the data that is stored for each entity or relationship and help in differentiating between instances of entities. For example, an Employee entity might have attributes such as EmployeeID, Name, Salary, and DateOfBirth.


    Types of Attributes in ER Model

    1. Simple (Atomic) Attributes:
      A simple attribute is an indivisible, basic attribute that cannot be further divided. These are also known as atomic attributes.

      • Example: Age, EmployeeID, ZipCode (cannot be broken down into smaller meaningful components).

      • Diagram Representation: Simple attributes are represented as ovals connected to their respective entity set or relationship.

    2. Composite Attributes:
      A composite attribute is an attribute that can be divided into smaller sub-attributes, each of which has its own meaning. A composite attribute is made up of two or more simple attributes.

      • Example: FullName can be a composite attribute consisting of FirstName and LastName.

      • Diagram Representation: Composite attributes are represented as ovals connected to the attribute itself, and the sub-attributes are connected to the composite oval.

    3. Derived Attributes:
      A derived attribute is an attribute whose value can be calculated or derived from other attributes in the database. These attributes are not directly stored in the database, but are instead computed when needed.

      • Example: Age could be derived from the DateOfBirth attribute.

      • Diagram Representation: Derived attributes are represented by dashed ovals.

    4. Multi-valued Attributes:
      A multi-valued attribute is an attribute that can have multiple values for a single entity. For example, a person can have multiple phone numbers or email addresses.

      • Example: A PhoneNumbers attribute might have multiple values such as (123-4567, 987-6543) for a single entity.

      • Diagram Representation: Multi-valued attributes are represented by double ovals.

    5. Key Attributes:
      A key attribute is an attribute that uniquely identifies an entity within an entity set. For instance, EmployeeID in an Employee entity is a key attribute because it uniquely identifies each employee.

      • Example: StudentID in a Student entity set.

      • Diagram Representation: Key attributes are typically underlined in the ER diagram.


    Examples of Attributes for Entities

    1. Employee Entity:

      • Attributes:
        • EmployeeID (Primary Key)
        • Name
        • DOB (Date of Birth)
        • Salary
        • Department
        • Address

      In this case:

      • EmployeeID is a simple attribute.
      • Name could be a composite attribute (with sub-attributes FirstName and LastName).
      • DOB is a simple attribute.
      • Salary is a simple attribute.
      • Department might refer to a relationship between Employee and Department entities.
      • Address might be a composite attribute (with sub-attributes Street, City, and ZipCode).
    2. Course Entity:

      • Attributes:
        • CourseID (Primary Key)
        • CourseName
        • Credits
        • Instructor

      Here:

      • CourseID is a simple attribute (the primary key).
      • CourseName is a simple attribute.
      • Credits is a simple attribute.
      • Instructor could refer to an Instructor entity, potentially creating a relationship.

    Attribute Types Based on Usage

    1. Atomic (Simple) vs. Composite Attributes:

      • Atomic: These attributes have a single value and cannot be divided further.
      • Composite: These attributes are formed by combining simpler attributes.

      Example:

      • Atomic: Age
      • Composite: FullName (FirstName, LastName)
    2. Single-valued vs. Multi-valued Attributes:

      • Single-valued: An attribute that has only one value for an entity instance.
      • Multi-valued: An attribute that can have multiple values for an entity instance.

      Example:

      • Single-valued: EmployeeID (one ID per employee)
      • Multi-valued: PhoneNumbers (one or more phone numbers per employee)
    3. Derived Attributes:
      Attributes that are calculated or derived from other existing attributes.

      Example:

      • Age derived from DateOfBirth.

    Diagram Representation of Attributes

    • Simple Attribute: Represented as a single oval connected to the entity or relationship.
    • Composite Attribute: Represented as an oval connected to a main oval (entity) with additional ovals representing sub-attributes.
    • Multi-valued Attribute: Represented as a double oval.
    • Derived Attribute: Represented as a dashed oval.
    • Key Attribute: Represented by underlining the name of the attribute.

    Relationships Between Attributes

    Attributes can also be related to relationships in the ER model. A relationship in an ER diagram can have its own set of attributes, known as relationship attributes.

    For example, in a Course Enrollment relationship between Student and Course entities, the relationship might have an attribute like EnrollmentDate, which is an additional property of the relationship (not the entities themselves).


    Example ER Diagram for a University System

    Consider the following example ER diagram for a university system:

    • Entity: Student
      • Attributes: StudentID (Primary Key), Name, DOB, Email, PhoneNumbers (multi-valued)
    • Entity: Course
      • Attributes: CourseID (Primary Key), CourseName, Credits
    • Relationship: EnrollsIn (between Student and Course)
      • Attributes: EnrollmentDate (Derived from the relationship between Student and Course)

    Conclusion

    In the Entity-Relationship (ER) Model, attributes are crucial for describing entities and relationships. They define the properties of the entities and provide a structured way to store and retrieve data. Understanding the different types of attributes—simple, composite, derived, multi-valued, and key—is essential for creating an efficient and well-structured database design.

    Previous topic 23
    Entity Sets
    Next topic 25
    Relationship in Entity-Relationship Model

    Past Papers

    Open this section to load past papers

    Click on Show Past Papers to see past papers.
    On This Page
      Reading Stats
      Est. reading time5 min
      Word count849
      Code examples0
      DifficultyBeginner