WWW Geeksforgeeks Org Introduction of Er Model
WWW Geeksforgeeks Org Introduction of Er Model
Introduction of ER Model
Last Updated : 30 Aug, 2024
Peter Chen developed the ER diagram in 1976. The ER model was created to provide a simple and understandable model for representing the
structure and logic of databases. It has since evolved into variations such as the Enhanced ER Model and the Object Relationship Model
Generative Summary
The Entity Relational Model is a model for identifying entities to be represented in the database and representation
Now you can generateof how those entities are
the summary
of any article of your choice. Got it
related. The ER data model specifies enterprise schema that represents the overall logical structure of a database graphically.
The Entity Relationship Diagram explains the relationship among the entities present in the database. ER models are used to model real-world
objects like a person, a car, or a company and the relation between these real-world objects. In short, the ER Diagram is the structural format of the
database.
Components of ER Diagram
ER Model consists of Entities, Attributes, and Relationships among Entities in a Database System.
Components of ER Diagram
What is Entity?
An Entity may be an object with a physical existence – a particular person, car, house, or employee – or it may be an object with a conceptual
existence – a company, a job, or a university course.
Entity Set
We can represent the entity set in ER Diagram but can’t represent entity in ER Diagram because entity is row and column in the relation and ER
Diagram is graphical representation of data.
Types of Entity
There are two types of entity:
1. Strong Entity
A Strong Entity is a type of entity that has a key Attribute. Strong Entity does not depend on other Entity in the Schema. It has a primary key, that
helps in identifying it uniquely, and it is represented by a rectangle. These are called Strong Entity Types.
2. Weak Entity
An Entity type has a key attribute that uniquely identifies each entity in the entity set. But some entity type exists for which key attributes can’t be
defined. These are called Weak Entity types .
For Example, A company may store the information of dependents (Parents, Children, Spouse) of an Employee. But the dependents can’t exist
without the employee. So Dependent will be a Weak Entity Type and Employee will be Identifying Entity type for Dependent, which means it is
Strong Entity Type .
A weak entity type is represented by a Double Rectangle. The participation of weak entity types is always total. The relationship between the weak
entity type and its identifying strong entity type is called identifying relationship and it is represented by a double diamond.
What is Attributes?
Attributes are the properties that define the entity type. For example, Roll_No, Name, DOB, Age, Address, and Mobile_No are the attributes that
define entity type Student. In ER diagram, the attribute is represented by an oval.
Attribute
Types of Attributes
1. Key Attribute
The attribute which uniquely identifies each entity in the entity set is called the key attribute. For example, Roll_No will be unique for each
student. In ER diagram, the key attribute is represented by an oval with underlying lines.
Key Attribute
2. Composite Attribute
An attribute composed of many other attributes is called a composite attribute. For example, the Address attribute of the student Entity type
consists of Street, City, State, and Country. In ER diagram, the composite attribute is represented by an oval comprising of ovals.
Composite Attribute
3. Multivalued Attribute
An attribute consisting of more than one value for a given entity. For example, Phone_No (can be more than one for a given student). In ER diagram,
a multivalued attribute is represented by a double oval.
Multivalued Attribute
4. Derived Attribute
An attribute that can be derived from other attributes of the entity type is known as a derived attribute. e.g.; Age (can be derived from DOB). In ER
diagram, the derived attribute is represented by a dashed oval.
Derived Attribute
The Complete Entity Type Student with its Attributes can be represented as:
A set of relationships of the same type is known as a relationship set. The following relationship set depicts S1 as enrolled in C2, S2 as enrolled in
C1, and S3 as registered in C3.
Relationship Set
1. Unary Relationship: When there is only ONE entity set participating in a relation, the relationship is called a unary relationship. For example,
one person is married to only one person.
Unary Relationship
2. Binary Relationship: When there are TWO entities set participating in a relationship, the relationship is called a binary relationship. For
example, a Student is enrolled in a Course.
Binary Relationship
3. Ternary Relationship: When there are three entity sets participating in a relationship, the relationship is called a ternary relationship.
4. N-ary Relationship: When there are n entities set participating in a relationship, the relationship is called an n-ary relationship.
What is Cardinality?
The number of times an entity of an entity set participates in a relationship set is known as cardinality . Cardinality can be of different types:
1. One-to-One: When each entity in each entity set can take part only once in the relationship, the cardinality is one-to-one. Let us assume that a
male can marry one female and a female can marry one male. So the relationship will be one-to-one.
2. One-to-Many: In one-to-many mapping as well where each entity can be related to more than one entity and the total number of tables that can
be used in this is 2. Let us assume that one surgeon department can accommodate many doctors. So the Cardinality will be 1 to M. It means one
department has many Doctors.
3. Many-to-One: When entities in one entity set can take part only once in the relationship set and entities in other entity sets can take part more
than once in the relationship set, cardinality is many to one. Let us assume that a student can take only one course but one course can be taken by
many students. So the cardinality will be n to 1. It means that for one course there can be n students but for one student, there will be only one
course.
In this case, each student is taking only 1 course but 1 course has been taken by many students.
4. Many-to-Many: When entities in all entity sets can take part more than once in the relationship cardinality is many to many. Let us assume that a
student can take more than one course and one course can be taken by many students. So the relationship will be many to many.
In this example, student S1 is enrolled in C1 and C3 and Course C3 is enrolled by S1, S3, and S4. So it is many-to-many relationships.
Participation Constraint
Participation Constraint is applied to the entity participating in the relationship set.
1. Total Participation – Each entity in the entity set must participate in the relationship. If each student must enroll in a course, the participation of
students will be total. Total participation is shown by a double line in the ER diagram.
2. Partial Participation – The entity in the entity set may or may NOT participate in the relationship. If some courses are not enrolled by any of the
students, the participation in the course will be partial.
The diagram depicts the ‘Enrolled in’ relationship set with Student Entity set having total participation and Course Entity set having partial
participation.
Every student in the Student Entity set participates in a relationship but there exists a course C4 that is not taking part in the relationship.
Conclusion
An Entity-Relationship (ER) model is a way to visually represent the structure of a database. It shows how different entities (like objects or
concepts) are connected and interact with each other through relationships. The model uses diagrams to represent entities as rectangles and
relationships as diamonds, making it easier to design and understand databases .
ER Diagrams are used to visually represent the structure of a database, showing entities, their attributes, and relationships between them.
They simplify the process of mapping out the database structure, making it easier to organize data and understand how different entities
interact.
A Strong Entity has a unique identifier or primary key, while a Weak Entity lacks a primary key and relies on a Strong Entity for identification.
Yes, ER Diagrams can model complex relationships, including one-to-one, one-to-many, and many-to-many relationships.
Why are Participation Constraints used in ER Diagrams?
Participation Constraints indicate whether all entities must participate in a relationship or if only some may do so, helping to accurately
represent real-world scenarios.
Reference
What is Normalization in DBMS?
SQL Concepts and Queries
Data Modeling: A Comprehensive Guide for Analysts
Best Practices For Documenting Database Design
"GeeksforGeeks helped me ace the GATE exam! Whenever I had any doubt regarding any topic, GFG always helped me and made my concepts
quiet clear." - Anshika Modi | AIR 21
Choose GeeksforGeeks as your perfect GATE 2025 Preparation partner with these newly launched programs
GATE CS & IT- Online
GATE DS & AI- Online
Over 150,000+ students already trust us to be their GATE Exam guide. Join them & let us help you in opening the GATE to top-tech IITs & NITs!
Advertisement
GeeksforGeeks 644
Similar Reads
Difference between Bottom-Up Model and Top-Down Model
Top-Down Design Model: In the top-down model, an overview of the system is formulated without going into detail for any part of it. Each part of it then
refined into more details, defining it in yet more details until the entire specification is detailed enough to validate the model. if we glance at a haul as a…
3 min read
This is exactly why we still use the OSI model when we have TCP/IP Model
What is the OSI Model?OSI is an acronym for Open Systems Interconnection. The International Organization for Standardization (ISO) created the OSI
model (ISO). It's a model for how applications communicate over the internet. In order to facilitate interoperability between diverse devices and…
10 min read
Relationships in ER model
Entity Relationship model (ER model) contains entities and relationships. ER model enables us to know how these entities are associated with each
other. Entities interact with other entities through associations or relationships. Let us assume that Geeks is the name of a student, Placement 100 is th…
2 min read
Company Languages
About Us Python
Legal Java
In Media C++
Contact Us PHP
Advertise with us GoLang
GFG Corporate Solution SQL
Placement Training Program R Language
GeeksforGeeks Community Android Tutorial
Tutorials Archive