The Entity-Relationship (ER) model was introduced by Peter Chen in 1976. It provides a conceptual (or logical) view of a database and is commonly used for designing databases. The ER model focuses on real-world entities and the relationships among them. A database schema in the ER Model can be visually represented as ER diagrams, which can be easily mapped into a relational schema.
Why is the ER Model Useful?
⇒ The constructs used in the ER Model can be easily transformed into relational tables.
⇒ Database designers can use the ER Model to communicate the database design to users.
⇒ Database developers can use the ER Model as a blueprint to implement a data model in specific DBMS software.
The basics of Entity-Relationship modeling include:
1.Entities
2.Attributes
3.Relationships
An entity is a "thing" or "object" in the real world that is distinguishable from other objects. Entities can be anything that has an independent existence and about which we collect data. This is also known as an entity type.
⇒ Example: In a school database, the students, teachers, classes, courses, or projects can be entities.
⇒ Representation: Entities are represented by rectangles in ER diagrams.
An entity set is a collection of similar types of entities that share the same attributes.
Attributes describe the properties of an entity.
Example: A Student entity may have attributes like Roll_No, Name, DOB, Age, Address, Mobile No.
Domain: Each attribute has a set of permitted values, called its domain.
Attributes are represented by ellipses in ER diagrams.
⇒ Example Schema (Entity type):
Student (Roll_No, Name, DOB, Address)
⇒Simple and Composite Attributes
⇒Single-Valued and Multi-Valued Attributes
⇒Stored and Derived Attributes
A relationship is an association among entities.
⇒ An employee works_at a department.
⇒ A student enrolls in a course.
⇒ In these examples, Works_at and Enrolls are called relationships.
Relationships are represented by diamond-shaped boxes in ER diagrams.
⇒ Example: One person is married to only one person.
⇒ Binary Relationship (Degree = 2): Two entities participate in the relationship. This is the most common type of relationship.
⇒ Example: A student is enrolled in a course.
⇒ Ternary Relationship (Degree = 3): Three entities participate in the relationship.
⇒ Example: The university records which teachers taught which subjects in which courses.