E-R Model In DBMS

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 32

ER MODEL IN DBMS

ER MODEL
 ER model stands for an Entity-Relationship model. It is a
high-level data model. This model is used to define the
data elements and relationship for a specified system.
 It develops a conceptual design for the database. It also

develops a very simple and easy to design view of data.


 In ER modeling, the database structure is portrayed as a

diagram called an entity-relationship diagram.


For example, Suppose we design a school database. In this
database, the student will be an entity with attributes like
address, name, id, age, etc. The address can be another
entity with attributes like city, street name, pin code, etc
and there will be a relationship between them.
COMPONENT OF ER DIAGRAM
 ENTITY:

 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.
WEAK ENTITY SETS
 An entity that depends on another entity called a weak
entity.
 The weak entity does not contain any key attributes of

it’s own.
 The weak entity is represented by double rectangle.
WEAK ENTITY SETS
A weak entity set is an entity set that does not contain
sufficient attributes to uniquely identify its entities. In
other words, a primary key does not exist for a weak
entity set. However, it contains a partial key called as a
discriminator. Discriminator can identify a group
of entities from the entity set.
2. ATTRIBUTE
The attribute is used to describe the property of an entity.
Eclipse is used to represent an attribute.
For example, id, age, contact number, name, etc. can be
attributes of a student.
 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.
COMPOSITE ATTRIBUTE
An attribute that composed of many other attributes is
known as a composite attribute. The composite attribute
is represented by an ellipse, and those ellipses are
connected with an ellipse.
MULTIVALUED ATTRIBUTE
An attribute can have more than one value. These attributes
are known as a multivalued attribute. The double oval is
used to represent multivalued attribute.
For example, a student can have more than one phone
number.
DERIVED ATTRIBUTE
An attribute that can be derived from other attribute is
known as a derived attribute. It can be represented by a
dashed ellipse.
For example, A person's age changes over time and can be
derived from another attribute like Date of birth.
CASE STUDY
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 .
CASE STUDY
RELATIONSHIP
 A relationship is an association between two or more
entities of same or different entity set. A set of
relationships of same type is known as relationship set.
DEGREE OF RELATIONSHIP
 The number of different entity sets participating in a
relationship set is called as degree of relationship.

Types of relationship
 Unary Relationship

 Binary Relationship

 Ternary Relationship
UNARY RELATIONSHIP
 When there is only one entity set participating in a
relation, the relationship is called Unary.
BINARY RELATIONSHIP
 When there are two entities set participating in a relation,
the relationship is called Binary.
For example, Student is enrolled in course.
TERNARY RELATIONSHIP
 When there are three entities set participating in a
relation, the relationship is called Ternary.
For example, Employee works in a department located in
any location.
CARDINALITY OF
RELATIONSHIP
 The cardinality of a relationship is the number of entities
to which another entity can map under that relationship.
 It is most useful in describing the relationship sets that

involve more than two entity sets.


 There are four possible mapping cardinalities. These are

as follows:
i. One to one (1:1)
ii. One to many (1:M)
iii. Many to one (M:1)
iv. Many to many (M:M)
ONE-TO-ONE
In one-to-one mapping, an entity in E1 is associated with at
most one entity in E2, and an entity in E2 is associated
with at most one entity in E1.
For example, a female can marry to one male, and a male
can marry to one female.
ONE-TO-MANY
When only one instance of the entity on the left, and more
than one instance of an entity on the right associates with
the relationship then this is known as a One-To-Many
relationship.
For example, Scientist can invent many inventions, but the
invention is done by the only specific scientist.
MANY-TO-ONE
When more than one instance of the entity on the left, and
only one instance of an entity on the right associates with
the relationship then this is known as a Many-To-One
relationship.
For Example, Student enrolls for only one course, but a
course can have many students.
MANY-TO-MANY

In many-to-many mapping, an entity in E1 is associated


with any number of entities in E2, and an entity in E2 is
associated with any number of entities in E1.
MANY-TO-MANY

When more than one instance of the entity on the left, and
more than one instance of an entity on the right
associates with the relationship then this is known as a
Many-To-Many relationship.
For example, Employee can assign by many projects and a
project can have many employees.
KEYS
 Keys play an important role in the relational database.
 It is used to uniquely identify any record or row of data

from the table. It is also used to establish and identify


relationships between tables.
For example: In Student table, ID is used as a key because
it is unique for each student. In PERSON table,
passport_number, license_number, SSN are keys since
they are unique for each person.
TYPES OF
KEY:
 PRIMARY KEY
It is the first key which is used to identify one and only one
instance of an entity uniquely. An entity can contain
multiple keys as we saw in PERSON table. The key
which is most suitable from those lists become a primary
key.
 SUPER KEY
 Super key is an attribute set that can uniquely identify a
tuple. A super key is a superset of a candidate key.
ENTITY RELATIONSHIP
DIAGRAM
WHAT IS AN ENTITY RELATIONSHIP
DIAGRAM (ERD)?
An entity relationship diagram (ERD) shows the
relationships of entity sets stored in a database. An entity
in this context is an object, a component of data. An
entity set is a collection of similar entities. These entities
can have attributes that define its properties.

By defining the entities, their attributes, and showing the


relationships between them, an ER diagram illustrates
the logical structure of databases.
ER diagrams are used to sketch out the design of a
database.
LINK
 Explore this link to get help to read all topics of DBMS
 https://www.javatpoint.com/dbms-keys
THANK YOU

You might also like