Entity Types, Entity Sets, Keys, and Value Sets in the ER Model

 

Entity Types, Entity Sets, Keys, and Value Sets in the ER Model

Understanding entity types, keys, and value sets is fundamental to conceptual database design using the Entity–Relationship (ER) model. These concepts help us represent real-world objects accurately and enforce important data constraints.


1. Entity Types and Entity Sets

Entity Type

An entity type represents a collection of similar real-world objects that share the same attributes.

📌 Example

  • EMPLOYEE entity type
    Attributes: Name, Age, Salary

  • COMPANY entity type
    Attributes: Name, Headquarters, President

Each entity type defines the structure (schema or intension) of data.


Entity Set (Entity Collection)

An entity set is the collection of all entities of an entity type at a specific time.

📌 Example EMPLOYEE entity set

  • (John Smith, 55, 80K)

  • (Fred Brown, 40, 30K)

  • (Judy Clark, 25, 20K)

Although the same name is often used for both (e.g., EMPLOYEE), conceptually:

  • Entity type → Definition

  • Entity set → Actual data (extension)




ER Diagram Representation

  • Rectangle → Entity type

  • Oval → Attribute

  • Double oval → Multivalued attribute

  • Composite attributes → Linked to component attributes


2. Key Attributes

What Is a Key?

A key attribute uniquely identifies each entity in an entity set.

📌 Examples

  • Name is a key for COMPANY

  • SSN is a key for PERSON

  • Vehicle_id is a key for CAR


Composite Keys

Sometimes, multiple attributes together form a key.

📌 Example

  • Registration = (State, Number) for CAR
    Neither attribute alone is unique, but together they uniquely identify a car.

📌 Important Rules

  • Composite keys must be minimal

  • No unnecessary attributes allowed


Multiple Keys

An entity type may have more than one key.

  • CAR has both Vehicle_id and Registration

  • Each is a valid key

📌 ER Diagram Notation

  • Key attributes are underlined

⚠️ The ER model does not define a primary key—this is chosen later during relational mapping.





Weak Entity Types

If an entity type has no key of its own, it is called a weak entity type.

  • Identification depends on a related strong entity

  • Discussed in later sections


3. Value Sets (Domains)

What Is a Value Set?

A value set (domain) specifies the allowed values for an attribute.

📌 Examples

  • Age → Integers from 16 to 70

  • Name → Alphabetic strings

  • Sex → {Male, Female, Other}

Value sets:

  • Enforce valid data

  • Are similar to data types in programming languages

  • Are usually not shown in basic ER diagrams


Common Attribute Data Types

  • Integer

  • String

  • Boolean

  • Float

  • Date / Time

  • Enumerated types


4. Formal Definition of Attributes

Mathematically, an attribute A of an entity set E with value set V is defined as:

A:EP(V)A : E \rightarrow P(V)

Where:

  • P(V) is the power set of V

  • A(e) is the value of attribute A for entity e


Handling NULLs and Multivalued Attributes

  • NULL → Represented as an empty set

  • Single-valued attribute → Exactly one value

  • Multivalued attribute → Any number of values allowed


Composite Attribute Value Sets

For composite attributes, value sets are derived from the Cartesian product of their component attributes.

📌 Example

  • Address = (Street, City, State, Zip)

Only a small subset of possible values exists in the database at any given time—this represents the current state of the miniworld.


5. Key Takeaways

✅ Entity types define structure; entity sets store data
✅ Keys enforce uniqueness
✅ Composite keys must be minimal
✅ Value sets define valid attribute values
✅ ER modeling focuses on constraints derived from the real world


Why This Matters

These concepts form the foundation of ER modeling, influencing:

  • Schema correctness

  • Data integrity

  • Smooth mapping to relational databases

Comments

Popular posts from this blog

Database Management Systems DBMS PCCST402 Semester 4 KTU CS 2024 Scheme

Database Management Systems DBMS PCCST402 Scheme and Syllabus

Introduction to Database Management System -DBMS