Sie sind auf Seite 1von 29

ENTITY RELATIONSHIP MODEL

NEHA J MENDJOGE

ENTITY SETS
An entity is 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 set is a set of entities of the same type

that share the same properties.


2 NEHA J MENDJOGE

Example: set of all persons, companies, trees,


holidays

REPRESENTING ENTITIES

ENTITY_NAME

NEHA J MENDJOGE

EXAMPLE OF ENTITIES

CUSTOMER_NA ME
CUSTOMER_ ID CUSTOMER_CIT Y CUSTOMER_STR EET

CUSTOMER

NEHA J MENDJOGE

Entity Sets customer and loan


customer-id customer- customer- customername street city loanamount number

NEHA J MENDJOGE

TYPES OF ATTRIBUTES
SIMPLE: COMPOSITE

MULTI VALUED: DERIVED:

NEHA J MENDJOGE

EXAMPLE OF ATTRIBUTES
CUSTOMER_STR EET CUSTOMER_ ID

CUSTOMER_DAT E_OF_BIRTH

TELNO

CUSTOMER

AGE
NAME

FNAME

MNAME

LNAME

NEHA J MENDJOGE

EXAMPLE OF ATTRIBUTES
CUSTOMER_STR EET CUSTOMER_ ID

CUSTOMER_DAT E_OF_BIRTH

TELNO

CUSTOMER

AGE
NAME

FNAME

MNAME

LNAME

NEHA J MENDJOGE

RELATIONSHIP SETS
A relationship is an association among several

entities

EXAMPLE: CUSTOMER HAS ACCOUNT


CUSTOMER

HA S

ACCOUNT

NEHA J MENDJOGE

DEGREE OF A RELATIONSHIP SET


Refers to number of entity sets that participate in

a relationship set.
Relationship sets that involve two entity sets are

binary (or degree two). Generally, most relationship sets in a database system are binary.

10

NEHA J MENDJOGE

MAPPING CARDINALITIES
Express the number of entities to which

another entity can be associated via a relationship set.


For a binary relationship set the mapping cardinality must be

one of the following types:

One to one
One to many Many to one Many to many

11

NEHA J MENDJOGE

ONE TO ONE MANY

ONE TO

12

NEHA J MENDJOGE

MANY TO ONE MANY

MANY TO

13

NEHA J MENDJOGE

CARDINALITY CONTRAINTS
ONE TO ONE RELATIONSHIP

14

NEHA J MENDJOGE

ONE TO MANY RELATIONSHIP


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

15

NEHA J MENDJOGE

MANY TO ONE RELATIONSHIP


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

16

NEHA J MENDJOGE

RELATIONSHIP
A customer is associated with several (possibly 0)

loans via borrower A loan is associated with several (possibly 0) customers via borrower

17

NEHA J MENDJOGE

PARTICIPATION OF ENTITY IN RELATIONSHIP

18

NEHA J MENDJOGE

Total participation (indicated by double line): every

entity in the entity set participates in at least one relationship in the relationship set E.g. participation of loan in borrower is 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 customer in borrower is partial

19

NEHA J MENDJOGE

KEYS
PRIMARY KEY: SUPER KEY: A super key of an entity set is a set

of one or more attributes whose values uniquely determine each entity.


CANDIDATE KEY:A candidate key of an entity set

is a minimal super key

20

NEHA J MENDJOGE

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 NEHA J MENDJOGE

WEAK ENTITY SET


An entity set that does not have a primary key is

referred to as a weak entity set.

22

NEHA J MENDJOGE

WEAK ENTITY SET


discriminator

23

NEHA J MENDJOGE

Identifying or owner entity set

Identifying relationshi p

SPECIALIZATION
The process of designating subgroupings within

an entity set.
Depicted by a triangle component 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 NEHA J MENDJOGE

25

NEHA J MENDJOGE

TERNARY RELATIONSHIP

27

NEHA J MENDJOGE

AGGREGATION
Suppose we want to record managers for a task

performed by an employee at a branch:

28

NEHA J MENDJOGE

29

NEHA J MENDJOGE

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.

30

NEHA J MENDJOGE

Das könnte Ihnen auch gefallen