THE ENTITY RELATIONSHIP MODEL IN DBMS.ppt

NehaJM 22 views 27 slides Jun 21, 2024
Slide 1
Slide 1 of 27
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27

About This Presentation

The Entity Relational Model is a model for identifying entities to be represented in the database and representation of how those entities are related. The ER data model specifies enterprise schema that represents the overall logical structure of a database graphically.


Slide Content

ENTITY RELATIONSHIP
MODEL
1

ENTITY SETS
2
An entityis an “thing” or “object” that exists in
the real world and is distinguishable from other
objects.
Example: specific person, company, event,
plant
Every entity has a set of properties i.e. the
attributes and values for those properties.
Example: people have names and addresses
An entity setis a set of entities of the same type
that share the same properties.
Example: set of all persons, companies, trees,
holidays

REPRESENTING ENTITIES
3
ENTITY_NAME

EXAMPLE OF ENTITIES
4
CUSTOMER
CUSTOMER_
ID
CUSTOMER_NA
ME
CUSTOMER_STR
EET
CUSTOMER_CIT
Y

5
customer-id customer-customer-customer- loan-amount
name street city number
Entity Sets customerand loan

TYPES OF ATTRIBUTES
6
SIMPLE:
COMPOSITE
MULTI VALUED:
DERIVED:

EXAMPLE OF ATTRIBUTES
7
CUSTOMER
CUSTOMER_
ID
CUSTOMER_STR
EET
CUSTOMER_DAT
E_OF_BIRTH
NAME
LNAME
MNAMEFNAME
AGE
TELNO

EXAMPLE OF ATTRIBUTES
8
CUSTOMER
CUSTOMER_
ID
CUSTOMER_STR
EET
CUSTOMER_DAT
E_OF_BIRTH
NAME
LNAME
MNAMEFNAME
TELNO
AGE

RELATIONSHIP SETS
9
A relationshipis an association among several
entities
EXAMPLE: CUSTOMER HAS ACCOUNT
CUSTOMER ACCOUNT
HA
S

DEGREE OF A RELATIONSHIP
SET
10
Referstonumberofentitysetsthatparticipatein
arelationshipset.
Relationshipsetsthatinvolvetwoentitysetsare
binary(ordegreetwo).Generally,most
relationshipsetsinadatabasesystemarebinary.

MAPPING CARDINALITIES
11
Expressthenumberofentitiestowhich
anotherentitycanbeassociatedviaa
relationshipset.
Forabinaryrelationshipsetthemappingcardinalitymustbe
oneofthefollowingtypes:
Onetoone
Onetomany
Manytoone
Manytomany

ONE TO ONE ONE TO
MANY
12

MANY TO ONE MANY TO
MANY
13

CARDINALITY CONTRAINTS
14
ONE TO ONE RELATIONSHIP

ONE TO MANY RELATIONSHIP
15
In the one-to-many relationship a loan is
associated with at most one customer via
borrower, a customer is associated with
several (including 0) loans via borrower

MANY TO ONE RELATIONSHIP
16
In a many-to-one relationship a loan is associated
with several (including 0) customers via borrower,
a customer is associated with at most one loan via
borrower

MANY TO MANY
RELATIONSHIP
17
A customer is associated with several (possibly 0)
loans via borrower
A loan is associated with several (possibly 0)
customers via borrower

18
PARTICIPATION OF ENTITY IN
RELATIONSHIP

Totalparticipation(indicated by double line): every
entity in the entity set participates in at least one
relationship in the relationship set
E.g. participation of loanin borroweris total
every loan must have a customer associated to it
via borrower
Partial participation: some entities may not participate
in any relationship in the relationship set
E.g. participation of customerin borroweris partial
19

KEYS
PRIMARY KEY:
SUPER KEY: A super keyof an entity set is a set
of one or more attributes whose values uniquely
determine each entity.
CANDIDATE KEY:A candidate keyof an entity set
is a minimal super key
20

ER DIAGRAM FOR
UNIVERSITY DATABASE
Draw E-Rdiagram for university database
consisting of four entities: Student, department,
Class,faculty
-student has a unique id,the student can enroll for
multiple classes
-Faculty must belong to department and faculty
can teach multiple classes
-Each class is taught by only one faculty
-Every student will get grade for the class he/she
has enrolled.
21

WEAK ENTITY SET
An entity set that does not have a primary key is
referred to as a weak entity set.
22

WEAK ENTITY SET
23
Identifying
relationshi
p
Identifying
or owner
entity set
discriminator

SPECIALIZATION
The process of designating subgroupings within
an entity set.
Depicted by a trianglecomponent labeled ISA
(E.g. customer“is a” person).
Attribute inheritance–a lower-level entity set
inherits all the attributes and relationship
participation of the higher-level entity set to which
it is linked.
The ISA relationship also referred to as
superclass -subclass relationship
24

25

TERNARY RELATIONSHIP
26

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.
27