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
    COMP2114
    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
    COMP2114›Entity Sets
    Database SystemsTopic 23 of 34

    Entity Sets

    5 minread
    894words
    Beginnerlevel

    Entity Sets in the Entity-Relationship (ER) Model

    An Entity Set is a collection of similar entities in a database. In the Entity-Relationship (ER) Model, an entity represents a real-world object or concept, while an entity set is a set of entities that share the same properties (attributes) but may represent different instances of that object or concept.

    In simpler terms, an entity set is a collection or group of entities that are described by the same set of attributes. Each entity in the set represents an individual instance of the object or concept the entity set models.


    Key Characteristics of Entity Sets

    1. Collection of Entities: An entity set consists of multiple entities of the same type. Each entity within the set is an individual instance or occurrence of the entity.

    2. Attributes: All entities in an entity set share the same set of attributes, although the values of those attributes differ between individual entities.

    3. Uniqueness: Each entity in an entity set is uniquely identifiable by a primary key or a set of attributes that collectively form a unique identifier.

    4. Entity Set vs. Entity: An entity refers to a single object (e.g., a specific person or item), whereas an entity set refers to the collection of all similar entities (e.g., all people or all products). For example, the "Student" entity set might contain entities like Alice, Bob, and Charlie, each with specific attributes (StudentID, Name, etc.).


    Example of an Entity Set

    Let’s consider a simple example of a Student entity set. The Student entity set may include individual entities such as:

    StudentID Name Age Address
    101 Alice 20 123 Main St.
    102 Bob 22 456 Elm St.
    103 Charlie 21 789 Oak St.

    Here, the Student entity set is a collection of all students, and each student is an instance of the Student entity. The Student entity set contains the attributes StudentID, Name, Age, and Address, but the values for these attributes will vary for each student.


    Representation of an Entity Set in ER Diagrams

    • Entity Set Representation: In ER diagrams, an entity set is represented by a rectangle. The name of the entity set is written inside the rectangle.
    • Attributes: Attributes associated with the entity set are represented by ovals connected to the entity set rectangle. If an attribute is a primary key, it is typically underlined.
    • Entity Instances: The actual data instances are not shown directly in the ER diagram, but in practice, each entity instance represents a row in the table corresponding to the entity set.

    Types of Entity Sets

    1. Strong (Regular) Entity Sets:

      • A strong entity set is an entity set that can be uniquely identified by its own attributes alone, without needing any reference to other entity sets. It typically has a primary key that uniquely identifies each entity instance.
      • Example: A Student entity set is a strong entity set, where StudentID uniquely identifies each student.
    2. Weak Entity Sets:

      • A weak entity set is an entity set that cannot be uniquely identified by its own attributes alone. It depends on a strong (owner) entity set for identification and uses a partial key in conjunction with the strong entity's key to form a unique identifier.
      • Example: A Dependent entity set might represent the children or relatives of employees. The Dependent entity cannot be uniquely identified without referencing the Employee entity, making it a weak entity.

    Key Points on Entity Sets

    • Identifying Attribute(s): The attribute(s) that uniquely identify each entity in an entity set are known as the primary key. In the Student entity set, StudentID could be the primary key.

    • Instances of an Entity Set: Each entity in an entity set is an instance that represents a specific occurrence of the entity. For example, "Alice" is an instance of the Student entity set.

    • Entity Set Cardinality: The cardinality of an entity set refers to the number of instances of that entity set. It can range from zero (no instances) to many (any number of instances). The cardinality can change over time as data is added or deleted.


    Entity Set Example in a University System

    Consider a University Database where we have the following entity sets:

    1. Student:

      • Attributes: StudentID, Name, Age, Major, Email
      • Primary Key: StudentID
    2. Course:

      • Attributes: CourseID, CourseName, Credits
      • Primary Key: CourseID
    3. Instructor:

      • Attributes: InstructorID, Name, Email
      • Primary Key: InstructorID
    4. Department:

      • Attributes: DepartmentID, DepartmentName, Building
      • Primary Key: DepartmentID

    Relationship Between Entity Sets

    Entity sets are often related to one another in the ER model. These relationships are represented as diamonds and connect the respective entity sets. For instance:

    • A Student can be enrolled in multiple Courses. This is a many-to-many relationship between the Student entity set and the Course entity set.
    • An Instructor teaches multiple Courses, which is a one-to-many relationship between the Instructor entity set and the Course entity set.

    Conclusion

    An entity set is a fundamental concept in the ER model. It represents a collection of similar entities and forms the basis for designing a database schema. Understanding entity sets is key to properly structuring the data and establishing relationships between the data elements in the database design process.

    Previous topic 22
    Entity-Relationship Model
    Next topic 24
    Attributes 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 count894
      Code examples0
      DifficultyBeginner