0% found this document useful (0 votes)
11 views24 pages

Entity Relationship Model

The document discusses the Entity-Relationship (ER) model, which is used to represent data and relationships in database systems. It covers various components such as entity sets, attributes, and types of keys, including strong and weak entities, as well as different types of attributes and relationships. Additionally, it explains mapping constraints and participation constraints that define how entities relate to one another within a database structure.

Uploaded by

totry.080
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views24 pages

Entity Relationship Model

The document discusses the Entity-Relationship (ER) model, which is used to represent data and relationships in database systems. It covers various components such as entity sets, attributes, and types of keys, including strong and weak entities, as well as different types of attributes and relationships. Additionally, it explains mapping constraints and participation constraints that define how entities relate to one another within a database structure.

Uploaded by

totry.080
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

attributes Marks the and Department,

and items) attributes.


5
system subject
constVS(entities
raints, 18, high-level system.
(data
Dec Example,
database faculty, as
entities
MU specified known
a Student, existence.
an
MODEL (keyconstusingraints
ER is the of are
which of a set
components
for such
properties
Design model of
elements
consists
existence
Example, logical
a
(ER) logical have
or
Additional
Conceptual desired data that existence.
Entity-Relationship may entity
various
data or
ER). the physical it
beyond world physical that
specifv among existencedescribes
ENTITY sets, generalization,
relationship
constraints real
relationships
have
to its
design of may with physical existence.
Model
(ER)
Entity-Relationship
the perception which
/ developeddatabase whichworld
aggregation
relations, ternary, components.
those properties
Model. and entities. world existence.
physical
independent
with logical
on components, real
of elements object
have
sets, Vs ER hen based real in
k binary step anything may own
3 entityentities,
attributes,
weak
relationship,
of Chas
Components first data is
Scientist the
is

among
relationships
define

these
among
model having
Relationships
Attributes

in
anything
Introduction
(1) is
be
may
its
Each
subject
has
entity
entity entitySection,
data diagram
model.
datarelationship
Diagrams Entities isEntity
constraints, Explain1976, model Entity
Syllabus ER An An
Entities, Vs
Entity In ER ER The ER
3.1 3.2
Database Systems' 3-2 Entity Relationship Model

(2) Entity Set


Entity set iscollection of entities of same type.
As in Student table, each row is an entity and have same attributes. In other words we can say a student
table is an entity type
The types of entity-sets are,
Types of Entities

(a) Strongentity type

(b) Weak entity type

Fig. 3.2.1:Types of entities


Example :
Student entity set contains all students in college database.
(a) Strong entities

Definition : Entity type which has itsown key atributes by which we can identify specific entity uniquely is
called as strong entity type.
Example :
In case of Employee entity any specific employee can be identifed by his Employeeid which is primary key of
employee entity.
Incase of student in class each student identified by unique roll number which is his primary key.
Strong entity type is represented by single rectangle.

EName
Employee_id
Age
Employee
Salary

Fig. 3.2.2: Employee entity


(b) Weak entities
Definition :Entity typewhich cannot form distinct key from their attributes and takes help from corresponding
strong entity iscalled as weakentily lype.
These types of entities are dependent on strong entity for primary key.
For some weak entities we assign virtual primary key. Such virtual primary key of weak entity is called as
'discriminator'.
Weak entitytype is represented by double rectangle.

Tech Kaomledge
Puollcatleas
Entity Relationship Mode

Database Systems' 3-3


|Dependent
Example : has,
Employee "dependent"
In case of "Dependent" entity depend on employee entity
entity for primary key. 3.2.3:
Weak
Fig.
3.3 Attributes
attributes.
Introduction knownas
properties are
Each entity has its own properties which describes that entity such databasse.
storedin
ofdata
The attribute value that describes each entity becomes a major part
Employee entity may be described by attributes name, age, phone etc. Notation
Type
Attribute (Simple/Single valued/Stored)

A particular entity will have some value for each of its attributes.
Example :
attribute value is Jayendra.
For an employee of with Employee_id 30, the name
3.3.1 Types Of Attribute
The various types of attribute are used in ER diagrams,
Types of Attributes in ER
Diagrams

(a) Composite Attributes

(b)Multivalued attributes

(c) Derived Attributes

(d) Null atribute

(e) Key attributes

Fig. 3.3.1:Types of attribute are used in ER diagrams


(a) Composite Attributes
subparts.
The attributes which can be divided in multiple
Notation
Type
Composite attribute

attributes.
The divisible attributes are composite

TechKaewledg!
PubIIcatie AS
Database Systems 3-4 Entity Relationship Model

Example :
The Name attribute of Student table can be divided into First_Name and LastName.
First_name
Name
Last_name
Employee

Fig. 3.3.2 :Composite attributes


b) Multivalued Attributes
The attribute having more then one value for a same entity is called as multi-valued attribute.
Type Notation

Multi valued Attribute

Example :
A
Single student can have multiple mobile numbers.
mobile

Employee
Fig. 3.3.3 Multi valued attributes
(c) Derived Attributes

Definition :The value of someattribute can bederived from the value of related stored attribute such attributes
are knouwn as derived attributes.

Type Notation

Derived attribute

Example :
Employee tenure can be calculated from stored attribute Date _of joining' of employee by subtracting it from
today's date.
Tenure Derived attribute

Date of joining Stored attribute

Employee

Fig. 3.3.4 : Derived attributes

Tech Kaowledge
PubIlcatlons
Mode called
Relationship
Entity
missing.
banking Banki
netng_Activattribute.
e_Bin' is
identified
for
key
student
one
offers a
called
net
applicable having
or
Bank
of
indicatesvalues table.
is
set only
can entity
customer missing row of an
(Say Super
key
'Net key one
ID
it. not attribute any
for table These
unsigned, which as in
valueed,unassigned, customer called
entity
with
by Employee each
Notation
attributes table one
student Candidate
keys Concept
have value Private
key
or
for
unknown, identify
not unknown, weather as a
in activated unique in
does banking Key record Key
3-5 uniquely only
entityis gives 3.3.5: 3.3.6:
a single have
which net not have Emp_id
use values DEPARTMENT_NUMBER
Fig.
when attribute of is Fig. attribute
Key possible
to PASSPORT_NUM
Stud
facility must a
of facility future Type identifies NUMBER
LICENCE_
valuevalue which whose
Bin' offer in
NULLthe banking used EMPLOYEE
NAME
StudDOB
Slud
activated. entity attributesis
uniquely It
Stud_ID
attribute Active not offers.
take be table.
does SSN
Banking
Net not can an
that of
can of entity. Emp_Id
not whichtill does attributes attribute for
employee. student
of
special
attribute
or null valueset
(e)
Key
Attributesof or
(d)
Database
Systems
Null
Attribute
a bank or
'Netactivated attribute attribute
column
is facility
always
an set. akey 1).
entity
This This The For =
is Example
: ID
Example
: Thiskey The An ID
is with
Database Systems' 3-6 Entity Relationship Model

3.3.2 Types of Keys


The various types of keys in ER Diagramsare as follows,

Types of Keys

1. Super Key

2. Composite Key

3. Candicdate Key

4. Primary Key

5. Alternate Key

6. Secondary Key

Fig. 3.3.7:Types of keys


1. Super Key
An attribute or set of attributes that uniquely identifies a single tuple in entity.
There can be more than one super keys in single table
Stud_Passport_Num Licence_ Number, ssn) acts like
Example : In Fig. 3.3.6 combination of (Stud_ID, Stud_name,
a super key.
2. Composite Key
identifies a single tuple in entity.
Any key with more than one attributes that uniquely
so, it is a composite key.
Example: In Fig. 3.3.6 a super key has more than one attribute
3. Candidate Key
attributes is a candidate's key.
Asuper key with minimum number of
No subset of candidate key van be key.
key.
(Stud_Passport_Num, Licence_Number,ssn) acts like a Candidates
Example :ln Fig. 3.3.6 combination of
4. Primary Key
entity.
selected key of strong entity which uniquely identify tuple in entity is a primary key of that
A
(Stud_ID) acts like a Primary key.
Example: In Fig.3.3.6 combination of
5. Alternate Key
selected as primary key.
ACandidate key which is not key
(Stud_Passport_ Num, Licence_Number, ssn) acts like alternate
Example: In Fig. 3.3.6 candidate key
6. Secondary Key
used to access a single tuple in entity.
An attribute or set of attributesthat is
be unique
The secon dary key not necessary to Tech Kaowledge
PuDllatieS
ModaEntityacting
ipnshioRelat tha PubtiCat
of
is key
it
so entity. primary for
data, working relatios
student's entity.intuple down.
ais entity. are particular
intuplesingle entity
accessing key. to
employees
singleidenticandi
a fies date's intuple intuple up
or
right
Department| a
in
types
for identifies identify single entities.
to
Works_for many
used a
Definition uniquely key a Notation left The entity
ais from
De attributes
of uniquely primary
access one
for set.relationship.participating
than it
(Stud_Passport_Num)
can uniquely read Works_forDiagram relationship
attributes
that to
as used
more
3-7 key. which be
selected Works_For of
that number that or relationship. to ER
be one relationship are,
number
van entity attributes 3.4.1: is
attributes
not among type degree
one key
with
minimum
key Type Relationship
than strong is
candidate which show EmployeeFig. sameof is
typeon
of of association arrange Department. set
relationship based
attribute set more
or
of
key
key
set
or
to
of
relationship
relationship BinaryRelationship
Ternary
UnaryRelationship
Relationship
with
attribute of
selected
A
Candidate
attribute
An
shape
to
recommended
ofDegree Relationship
Relationship
In
Fig.
3.3.6 subset an
is diamond
key super
A entity.
relationship
for is degree
ofThe
like
secondary
key An
Any No works Set
Relationship
all it
A Relations so
Introduction
use of departments of
Database
Systems
Composite
Key Candidate Secondary
Key Employee
:Example Collection Types
Example:
Key
Type Key Alternate
Key is
Primary
key We
Super
Key A It
3.4
1. 2. 3.
Database Systems 3-8 Entity Relationship Model

3.5 Additional Constraints

Relationship Types

A. Mavpng Constraints / Carcinalities

i. One is to one

i. One to many

il. Many lo one

iv. Many to many

B. Participation constraints

i. Total participation

i. Partial participation

C. Degree of Relationship

Binary relationship type

ii. Ternary relationship type

Fig. 3.5.1 : Relationship Types


(A) Mapping Constraints / Cardinalities
Number of entities from each side participating in a relationship set.
Cardinality expresses specific number of entity occurrence of related entity.
Types of mapping constraints
(i) One is to one
In thistype of constraint one tuple in entity is related with only one tuple in other entity.
That is one row in table is related with only one row in other table.
Aassociated with at most one entity in B, B associated with at most one entity in A.
Example :
A
associated with at most one entity in B, B associated with at most one entity in A.
One department can have only one manager.
Every row inDepartment table can be having relationship with only one row in Managers table.
Department Manager

Department Have Manager


A B

(a) One to one mapping (b) Representation in ER diagram


Fig. 3.5.2: One to one mapping
Tech Knowledge
PuDIlcation s
Entity Relationship Mode
Database Systems 3-9
(ii) One to many entity.
other
manytuplesin
In this type of with
constraint one tuple in entity can be related
Aassociated with any
nunmber of entities in B.
Bassociated with at
most one entity in A.
Example :
One teacher may teach to many
students. Student table.
Every row in Teacher table can have relationship with many rows in

Student
Teacher Students Teacher Teaches
A

diagram
(a) One to many mapping (b) Representation in ER

Fig. 3.5.3: One to many mapping


(ii) Many to one
In this type of constraint many tuple in entity can be related with only one tuple in other entity.
A
associated with at most one entity in B.
Bassociated with any number of entities in entity A.
Example :
Number of employee works for department.
Multiple rows in Employees table can be related with only one row in Department table.
Employee Department

1
Employee Works_fop
A B
Department

(a) Many toone mapping (b)


Fig. 3.5.4
Representation in ER diagram
(iv) Many to many
In this type of constraint many tuple in entity can be related with multiple tuples in other
Aassociated with any number of entities in entity B. entity.
Bassociated with any number of entities in entity A.

Tech Knowledg
Pubitatioh)
Database Systems 3-10 Entity Relationship Model
Book Student

M
Book Issued Student
by
A B

(a) Many to many mapping (b) Representation in ER diagram


Fig. 3.5.5
Example :
Books in library issued by students.
Multiple rows in Book table can be related with many rows in Student table.
(B) Participation constraints
(0) Total participation
In case of total participation every object in an entity must participate in a relationship.
The total participation is indicated by adark line or double line between entity and relationship.
Example :
Every department must have a manager.

Department Managed_by Manager

Fig. 3.5.6:Total participation


(ü) Partial participation
In case of partial participation more than one object in an entity may participate in arelationship.
The total participation is indicated by a single line between entity and relationship.
Example :
Employees works for department.

Employee Works_for Department

Fig. 3.5.7 :Partial participation


() Degree of Relationship (Binary Vs ternary)
The degree of the relationship type is number of participating entity types.
Types
() Binary relationship type
Arelationship of degree two.

Tech Kaewledge
Putic ations
RelModeEntatioitnshiy p class
the 18,5 super
of
conceptare Dec.
called
distinguishing
a
schema
MU
is
the type
includesEER
Department Project in
entity
some
arise
also this of
Relationship No.
Part relationship
3.5.9:Ternary
Fig. itadditionthey type, basis
Quality when inheritance
Attribute
3. Features entity the
1. Generalization
2.
Specialization on
defined
Modelmodel. concepts Aggregation
4. relationship.
In Features
EER of
Works_tor Supply EER subclass
3-11
Binary Part
department. 3.6.1:
ER isspecialization
3.5.8: (ER) these
of
of
concept
Entity-Relationship
displaying Fig. subclass
set
for Fig. Supplier diagrams. a
three. defining
Specialization.
works Employee modeling superclass/
type
degreeName generalization.
and
specialization forms
Employees for EER of
relationship
of the technique
as process that
relationship all called Specialization
:on ofapproach subclasses
includes class.
Example,
Extended diagrammatic
diagrams note a
is specialization.
Specialization
super
Ternary short
Database
Systems A down
model of
Features
EER
schema aWrite set inentity
(ii) EER Top The
A 3.6.1
3.6 Q.
Database Systems` 3-12
Entity Relationship Model

Example :
Set of subclass (Saving Account, Current Account) are Specialization of super class Account.
Account

Saving_Account Current_Account

Fig. 3.6.2 : Specialization


Notation

The subclass defined in aspecialization is attached by lines to acircle which is connected to super class.
The subset symbol on each line connecting a subclass to circle indicates the direction of super class / subclass
relationship.
Specific attribute
An attributeapplied only to entities of particular subclass is called as specific attribute.
3.6.2 Generalization
Wite a short note on :Generalization. MU - Dec.18, 5 Marks

This is reverse process of specialization or this is bottom up approach of Superclass/subclass relationship.


Definition

Definition : Generalization is a process in which we differentiate among several entity types identifying there
common features and generalizing them to a single super class of which original entity type are special subclass.

Example :
Carand Bike allhaving severalcommon attribute they can generalize to the super class vehicle.
Notation

Adiagrammatic notation to distinguish between generalization and specialization is used in some programming
methodologies.
Arrow pointing to generalized superclass represents generalization.
Arrow pointing to generalized subclass represents specialization.

Tyre Model Company Model

Maxspeed) Owner
Car
BIKE

Average Fuel_type
Owner Average no. of passengers

Fig. 3.6.3 : BIKE entity Fig. 3.6.4: Car entity

TechKnewledge
PubIICations
Entity Relationship Mode
Database Systems
3-13
3.6.3
The
Attribute inheritance
attributes of higher and lower level entities created by specialization and generalizations are attribute;

inheritance.
Abstraction through which relationship (aggregation) is treated as higher level entíties.
Ychiclo ia Modol
Owner

VEHICLE
Average

Tyre (Model Company (Model

Owner
BIKE Maxspeed) Car

Average Fuel_type
Owner Average <no. of passengers

Fig. 3.6.5 :Generalized VEHICLE entity


3.6.4
Constraintsand Characteristics of Specialization and Generalization
Constraínts and Characterístics
of Specialization and Generalization

1. Predicate defined subclass

2. Attribute defined specialization

3. User defined subclass

4. Other constraints specialization

a. Disjointness

i. Disjoíntness constraints

ii. Overlapping constraints

b. Completeness constraints

i. Total special1zation

Hü Partial specialization

ii, Posible constraints

Fig. 3.6.6

(1) Predicate defined subclass


exactly which entities will become
In specialization sometimes we can find member of specific subclass by
placing a condition (or apredicate) on the value of some attributes of superclass, such subclasses are called as
predicate subclasses.
Example:
condition job_type = 'typist'
Employee has attribute job_type. We can put
Tech Kaeuledg!
PubIlcatioRS
Database Systems' 3-14 Entity Relationship Model
name
(addross

emp-id (Job_type
Employe
job_type= job_type=Engineer"
"Secretary"
Typing_speed Post
Tgad job_type
Technician"
Secretary Technical Engineer

Fig. 3.6.7 : Predicate defined specialization


(2) Atribute defined specialization
If all subclasses in a specialization have their membership condition on some attribute of superclass then
the specialization itself is called as attribute defined specialization.
This kind of attribute is called as defining attribute of specialization.
name (address

(Emp_id job_type
Employee
Job_type
"Secretary"
"Engineer
Typing_speed Post
Tgrade Technician
Secretary Technician Engineer

Fig. 3.6.8: Attribute defined specialization


(3) User defined subclass
a subclass hence user needs
When we do not have a predefined condition for determining membership to
is known as user defined subclass.
to specify condition for such specialization then the subclass
applies the operations
Membership in such a subclass is determined by database user, when database user
to add an entity to subclass.
not by any condition that may be evaluated
Hence membership is specialized for each entity by user and
automatically.
(4) Other constraints specialization
(a) Disjointness
specify that the subclasses of specialization must
(i) Disjointness constraints :Disjointness constraints
most one subclass of specialization.
be disjoint that means entity can be a memberof the
Example :
Assistant, Technician or Engineer only.
New employee can become member of only one subclass like
Attribute defined Specialization determines the disjointness constraints.
should be single valued.
If attribute is used to define the membership then predicate
Tech Kaomledge
PuDlatiens
Relationship
Payscale
Hourly_Employee i.e.
overlaped
Belongs_To Trade_Union
Salary Post be
can
valsiuned.gl3.eFig.6in.9, (Address Salary) Salaried_Employee| Staff
entities
Address constraint
of
Birthdate) constraints set
Major
Employee name such
:be shown Manager Overlapping
must Emp_id Specialization) then
Disjoint Sex Alumni Degrees
3-15 Person Degree disjoint,
that as Manages Project
dencircled
predicate 3.6.9: Date-of-birth 3.6.10:
Name Engineer be
Year)
Fig. to
Typeby Perid required
Fig.
indicated
subclass
Disjoint
Specialization Student Admin
Job_ Technician
constraints
Overlapping
(ii) dept subclasses.
always
employee
entity
Subject feespaid not
Aid
Assistant
Typingspeed is the
subclass
more
Example
:
Database
Systems' In
of
The part
Entity Relationship Model
Database Systems' 3-16

Example :
Admin or Staff. It is possible to have person
Person can become member of subclasses like student.
belonging to more than one subclasses.
Disjoint subciass is indicated by encircled '0'.
(b) Completeness constraints
(i) Total specialization
may be member of at least one of
Atotal specialization constraints specifies that entity in super class
the subclass in the specialization.
Adouble line is used to represent total specialization in EER diagram.
Example :
An employee must belong to salaried employees or hourly employee.
Employee

Salaried Hourty

Fig. 3.6.1O(a) : Total specialization

(i) Partial specialization


An entity can either belong to a subclass or not belongs to any subclass.
single line used to represent partial specialization in EER diagram.
A
Example :
An employee can be Engineer, Secretary or Technician.
Employee

Engineer|Secretary Technician

Fig. 3.6.10(b) : Partial specialization

(iii) Possible constraints


Disjoint, total constraints
Disjoint, partial constraints
Overlapping, total constraints
Overlapping, partial constraints

TechKasuledga
Puollcations
RelModeEntatitoy.nship
participation
in
Monitors
aggregation. and
Authors
names.
parts. title by
component their
has written
relationship
set. has
Publication
purpose
of
is
This
is which
Publication
its
and
department). Journals.
subject
objectaand forset Author
date.particular
in and
sets relationship. year published
whole
betweena
s
entityentity
involving :Aggregation
3.7.1
Fig. Topicto Location
belongs
or
an project are
title,
Student
Publication Publisher Publication
3-17 as simple issues includes
Articles also
set not set. Publication
relationship ais sponsorship
arelationship
relationship (andrelationship article.
Article Journal
Author Title
This Book
department.
edition ER an category.number.
Book
using or
book 2. 4. 6.
a a
represent other
modeltreat and mobile Location)
(Title,
Publication
Designabe title
to to a thisany and attributes
Identify
by like may their
to have us Employee
An
monitors
sponsored address
entities
Identify
Publication
Aggregation
meant allows
we
table Conceptual
publication
having
Subject
Article
is when relationships. the BookName.
Database
Systems Aggregation
Aggregation is to
used Project mapped A
Example: 1. 3. 5.
3.8.1:
Ex. 1: 2:
Step
is Soln.
: Step
It A 3.8
3.7 1.
Database Systems' 3-18 Entity Relationship Model

2. Book (Publisher id, Title, Category)


(Publishor_id Titlo

Book
(Catogory)
3 Article (Publisher id, Title, Date, Topic)
Publisher id Title

Articlo Dato

Topic

Journal (ID)
JID

Journal

5. Subject (SID, Name)


SID Name

Subject

6. Author (Auth id, Name, Address, Mobile)


Auth id Name

Author Address

Mobile

Step 3 : Identify relationships


1. Articles are published in Journal.
2. Publication is written by Author.
Artical Publication

Published_in Written_by

Journal Author
Tech Knewlede
PuDlicatie
RelEntatiotynship owns
whom
of
each
accidents.
customers
Subject subclass Published_in Company
_address)
Artide Joumal recorded
Subject of
set
a
has of
number
that
Articde model company
belongs_To belongs_TO any Company_name
3-19 Publication ER Book company
Insurance
particular
subject. to
final zero
car-insurance Accidents
Customer
get it
Book with
will associated
(b) (d) Company_id
Superclass we a
a Publication relations relationsPublication Witten_by
Author for
to diagram
belongs haS
Identify
inheritance above car
be BOOK
can orARTICLE.
Publication
E-R Each company
Insurance
(a) attributes
Publication entities entity
Company
(a)
all on
cars.
Construct
Merging
more all all
Database
Systemns Identify(c)
Car
Identify
3.
3.8.2:
Ex.
Step
4: 5:
Step Soln.:
(1) (2)
Database Systems 3-20
Entity Relationship Model
(b) Customer entity
Customner name Custoner ld

Customor

(c) Car entity


Car_modol car number

Owner_nane Car

(d) Accidents

Car Acc_id

Accidents

(3) Identify allrelationship


a) Car insurance company has a set of customers

1 N
Insurance company has Customer

b) Customer owns one or more car

M
Customer OWns Car

c) Each car associated with zero or any number of accidents

1
Car record Accidents

(4) Construct ER diagram by merging all above relationships


car_number
Cust id
Car_model
Customer owns car

Cust _name Owner_Name

register for rocorded

Company_ld Com Address)


Insurance Accidents
Company
Company _name Acc id Car

Tech Knowledge
PubItationS
RelEntatiassoci
uitly9 ated
(10
with
eachMarkg
Hosp_id) HName
doctors Hospital
medical HAddress
Hcity
examination
Date_of Medical
record
of
set conducted) Patient Doctors
Patient
conducted
the
and
Problem) examination
patients DName
conducted. Doctors
examination idDoc
Problem N
1
N
3-21 of
examination, Medical-record associated
set examination Doctor
salary)
Hcity)Padress) has has with
witha (ii) Qualification and has
and Salary patient
hospital HAddress,Qualification, test
test
various
of Pdiagnosis, Date_of
and each M various
a text
for Patient HName, (Record_id, id.
Record
patients Hospital doctorsHospital with
various
diagram Doctor of
DName,
Pname, record Patient
(Record associated
(Hosp_id, of of
ER of
record (ii) (Doc_id,idPat
(Pat_id,
Pname
Medical_Record relationships
Identify
(3) set set
Medical-record
Attributes
Identify
(2) hasa has
an ahas
Construct
patientaEntities
Identify
(1) Hospital patient
Doctor
Patient
Patient are
Database
Systemns' Hospital
() Hospital Hospital Doctors
Pdiagnosis
Paddress Each
:3.8.3
Ex. (iv) (ii) (ii) (iv) (b)
Soln.
: (a) (c) (d)
Database Systems' 3-22 Entity Relationship Model
(4) Construct ER Model from merging all above relationship
Pname
Patid Hos id Hos_Name
1
Pdignosis N
Admitted Haddress
Patlont Hospital
in
PAddress HCity
1
1

has has

Date of examiation
Medical Salary Doctor Doc_id
record

Record id Qualification DName


Problem

Ex. 3.8.4:Draw ER Diagram for banking enterprise. (10 Marks)


Soln.:
Branch_id)
(Br_Loc

1 N
Bank has Branch

1
(B_Jocation
B_code
LOANS
B_Name
LoanNo
Interest
Having Loan Type
works_for Balance N M
Amt
SNo Account Type
Issues
Slaff SName Aco_no
M
N
Post Salary Address 1 A_C Customer
C_Name)
\0gs C_jd Phone
ISA M
Aco _No.
Transactior
Saving Customer
Date_Time
Type Amount
Interest._rate (Initial_Ami

Tech Knele
Publc a ti
Entity Relationship Model
Database Systems
Draw ER Diagram for University database consisting
3-23 four Entities Student, Department, Class and Facuity.
Ex.3.8.5 :
Student has a unique id, the student can enroll for and has a most one
major.
Faculty mu_
multiple
classes
by only
faculty. Every studen
belong to department and faculty can teach Each classistaught (10 Marks
willget grade for the class he/she multiple classes.
Soln. : has enrolled.
Number
Name Age
Major
Address CID
SID 1
Student Class
enrolls

1
M M

has

gets for
M

1
DID GNo
Grade

Department Major
Marks
1
Major
(DName
M 1
works Faculty Teachers

FID (FName Address

Ex. 3.8.6: Draw an ER diagram for the education database that contains the
information about an in house company
education training scheme. The relevant relations are:
Course (course-no, title)
Offering (course-no, off-no, off-date, location)
Teacher (course-no, off-no, emp-no)
Enrolment (course-no, off-no, stud-no, grade)
Employee (emp-no, emp-name, job)
Student (stud-no, stud-name, ph-no)
Soln. : (10 Marks)
emp_no Employee

Teacher

off_no
has Course_ no
1 1
Ottering has
Course
$tud ng Student <Enroll

Grade

TechKao ledg!
PUbIcatloa
Database Systems' 3-24 Entity Relationship Model

Review Questions

a. 1 Explain ER Diagrams and its components.


o.2 Explain the term aggregation.
O.3 VWrite a short note on:
(0) Subclass and superclass
() Specialization and generalization
(ii) Type Inheritance
(iv) Weak entity set
Q.4 Wite short note on:Total participation, partial participation.
0.5 Define degree.
Q. 6 Explain different types of attributes in ER Model.
Q.7 What is strong entity? Explain with example.
a.8 What is weak entity ? Explain with example.
Q.9 Explain different types of attributes in ER Model.

Q. 10 Write a note on composite attributes.


Q. 11 Write a note on multivalued attributes.
Q. 12 Define Derived attribute.
Q. 13 Write a note on Key attributes. Explain various type of keys in ER Diagram.
Q. 14 What is relationship set?

DDO

You might also like