Professional Documents
Culture Documents
ER Diagram Representation
ER Diagram Representation
ER Diagram Representation
ER Diagram Representation
An ER diagram shows the relationship among entity sets. An entity set is a group of similar
entities and these entities can have attributes. In terms of DBMS, an entity is a table or attribute
of a table in database. ER diagram shows the complete logical structure of a database.
For example, suppose we design a university database. In this database, the student will be an
entity with attributes like name, id, age, address, etc. The address can be another entity with
attributes like city, street name, pin code, etc and there will be a relationship between them.
4/ ER Diagram Representation
1. Entity:
An entity is a thing in a real-world with independent existence. An entity can exist independently
and is distinguishable from other objects. It can be identified uniquely. An entity may be any
object, class, person or place. In the ER diagram, an entity can be represented as rectangles.
Consider an organization as an example- manager, product, employee, department etc. can be
taken as an entity.
i. Weak Entity:
An entity that depends on another entity called a weak entity. The weak entity doesn't contain
any key attribute of its own. The weak entity is represented by a double rectangle. For example –
a bank account cannot be uniquely identified without knowing the bank to which the account
belongs, so bank account is a weak entity.
2. Attribute
The attribute is used to describe the properties or characteristics of an entity. Oval or ellipse
shape is used to represent an attribute. For example, id, age, contact number, name, etc. can be
attributes of a student.
i. Key Attribute:
An attribute which can uniquely identify an entity in an entity set is called a key attribute. The
key attribute is used to represent the main characteristics of an entity. It represents a primary key.
The key attribute is represented by an ellipse with the text underlined.
4/ ER Diagram Representation
ii. Composite Attribute:
An attribute that composed of many other attributes (combination of other attributes) is known as
a composite attribute. The composite attribute is represented by an ellipse, and those ellipses are
connected with an ellipse.
4/ ER Diagram Representation
3. Relationship
A relationship is used to describe the relation between entities. Diamond or rhombus is used to
represent the relationship.
i. One-to-One Relationship:
When only one instance of an entity is associated with the relationship, then it is known as one to
one relationship. For example, a person has only one passport and a passport is given to one
person.
4/ ER Diagram Representation
Participation Constraints:
Total Participation – It specifies that each entity in the entity set must compulsorily
participate in at least one relationship instance in that relationship set. That is why; it is
also called as mandatory participation. Total participation is represented using a double
line between the entity set and relationship set.
Example: Double line between the entity set “Student” and relationship set “Enrolled in”
signifies total participation. It specifies that each student must be enrolled in at least one
course.
Partial participation − It specifies that each entity in the entity set may or may not
participate in the relationship. That is why; it is also called as optional participation.
Partial participation is represented using a single line between the entity set and
relationship set.
Example: “Courses” and “Enrolled_in” a relationship signifies the partial participation,
which means some courses are not enrolled by any of the student, i.e enrollments are
optional in that case.
Example:
In a university, a Student enrolls in Courses. A student must be assigned to at least one or more
Courses. Each course is taught by a single Professor. To maintain instruction quality, a
Professor can deliver only one course.
Solution:
Step 1) Entity Identification
We have three entities: (1) Student, (2) Course, (3) Professor
4/ ER Diagram Representation
Step 3) Identify Attributes
We have three entities Student, Course and Teacher.
Attributes of Entity Student are: Student_ ID, Student _Name & Student_Grade
Attributes of Entity Course are: Course_ ID, Course _Name
Attributes of Entity Professor are: Professor _ ID, Professor _Name & Professor_Salary
Example:
Construct an E-R diagram for a College with a set of Students. Where the relationship between
Student and College is many to one and College is the entity set is total participation in StudyIn
relationship set.
Solution:
Figure: E-R diagram for college where, each College must have at-least one associated Student.
4/ ER Diagram Representation
Example:
Construct an E-R diagram for a car-insurance company whose customers own one or more cars
each. Each car has associated with it zero to any number of recorded accidents.
Solution:
Example:
Design an E-R diagram for keeping track of the exploits of your favorite sports team. You should
store the matches played, the scores in each match, the players in each match and individual
player statistics for each match. Summary statistics should be modeled as derived attributes.
Solution:
4/ ER Diagram Representation
Example:
Construct an E-R diagram for a hospital with a set of patients and a set of medical doctors.
Associate with each patient a log of the various tests and examinations conducted.
Solution:
Here are some best practices or example for Developing Effective ER Diagrams.
4/ ER Diagram Representation
ER diagrams are translatable into relational tables which allow you to build databases
quickly.
ER diagrams can be used by database designers as a blueprint for implementing data in
specific software applications.
The database designer gains a better understanding of the information to be contained in
the database with the help of ER diagram.
ER diagram allows you to communicate with the logical structure of the database to
users.
A strong entity is an entity that is independent A weak entity is an entity set that cannot be
of any other entity in a schema. uniquely identified by its attributes alone.
Strong entity set always has a primary key. It does not have enough attributes to build a
primary key.
It contains a Primary key represented by the It contains a Partial Key which is represented
underline symbol. by a dashed underline symbol.
Strong entity is not dependent of any other Weak entity is dependent on strong entity.
entity.
The member of a strong entity set is called The member of a weak entity set called as a
as dominant entity set. subordinate entity set.
Strong entity is represented by single rectangle. Weak entity is represented by double rectangle.
Two strong entity’s relationship is represented While the relation between one strong and one
by single diamond. weak entity is represented by double diamond.
Strong entity may or may not participate in Weak entity always participates in entity
entity relationships. relationships.
4/ ER Diagram Representation