Entity Relationship (ER) Model
The Entity Relationship (ER) Model is a high-level conceptual data model
used to represent real-world objects and their relationships in a database.
It is mainly used during database design.
1. What is ER Model?
The ER Model describes the logical structure of a database using entities, attributes, and relationships. It helps database designers visualize data before implementation.
- Easy to understand
- Graphical representation
- Independent of DBMS
2. Entity
An entity is a real-world object that can be uniquely identified. Each entity represents a table in a database.
- Student
- Employee
- Course
[ STUDENT ]
3. Attributes
Attributes describe the properties or characteristics of an entity.
- Roll_No
- Name
- Marks
[ STUDENT ] | |-- Roll_No |-- Name |-- Marks
4. Types of Attributes
4.1 Simple Attribute
Cannot be divided further (e.g., Age).
4.2 Composite Attribute
Can be divided into sub-parts (e.g., Address → Street, City, Pin).
4.3 Single-Valued Attribute
Has only one value (e.g., Roll_No).
4.4 Multi-Valued Attribute
Can have multiple values (e.g., Phone Numbers).
4.5 Derived Attribute
Derived from other attributes (e.g., Age from Date of Birth).
5. Key Attribute
A key attribute uniquely identifies an entity.
- Roll_No (Student)
- Employee_ID (Employee)
[ STUDENT ] | |-- Roll_No (Primary Key)
6. Relationship
A relationship shows how two or more entities are related.
[ STUDENT ] --- enrolls --- [ COURSE ]
7. Types of Relationships
- One-to-One (1:1)
- One-to-Many (1:M)
- Many-to-Many (M:N)
1:1 → Person ── Passport 1:M → Teacher ── Students M:N → Student ── Course
8. Advantages of ER Model
- Easy database design
- Clear visualization
- Reduces design errors
- Easy conversion to tables
Practice Questions
- What is ER model?
- Define entity and attribute.
- Explain types of attributes.
- What is relationship? Explain its types.
- What is key attribute?
Practice Task
Draw an ER diagram for:
✔ Student – Course system
✔ Library management system
✔ Employee – Department system