Sei sulla pagina 1di 31

PRESENTATION

ER-DATAMODEL
IN
DBMS
P
R
E
S
OBJECTIVES

● Enti tyRelati o n sh ipMo de l

● Enti tyRelati onshipDiagram(ERD)

● E x t e n d e d Fe a t u r e s o f E R D
1 . E N T I T Y R E L AT I O N S H I P M O D E L

● E R Model- B asic C oncepts


● E n ti t y
● Att r i b u te s a n d i t st y p e s
● E n ti t y- s e ta n d ke y s
● Relati onsh ipAndMap
i n g C a rd i n a l i ty
ERModel-BasicConcepts

T h e E R m o d e l d e fi n e s t h e t h r e m o s t re l e va nt
steps.Itworksaroundreal-worldenti ti esand
t h e a s o c i ati o n s a m o n gt h e m . At v i e w l e v e l ,t h e
E R m o d e l i s c o n s i d e r e d a g o d o p ti o n f o r
designingdatabases.
● RequirementAnalysis
● C onceptual Database Design
● LogicalDatabaseDesign
R equirement Analysis

T h e ve r y fi rst ste p i n d e s i g n i n ga d ata b a s e


a p p l i cati o n i sto u n d e rsta n d w h atd ata u sto b e
storedinthedatabase,whatapplicati onsmust
b e b u i l t o n t h e t o p o fi t , a n d w h a t o p e ra ti o n s a r e
we m u stf i n d o u t w h att h e u s e rswa ntf ro m t h e
d ata b a s e .
ConceptualDatabaseDesign

Theinformati ongatheredintherequirements
a n a l ys i s ste p i su s e d to d eve l o p a h i g h - l eve l
d e s c r i p ti o n o ft h e d atato b e sto re d i n d ata b a s e ,
a l o n g w i t ht h e co n st ra i nts k n ow nto h o l d ove r
thedata.
T h e E R m o d e l i s o n e o ft h e h i g h - l e v e l o r

semanti c,datamodelsusedindatabase.
Logical Database Design

We m u s t c h o o s e a D B M S t o i m p l e m e n t o u r
databasedesign,andconvertt heconceptual
database design into a database schema in the
d ata m o d e l o fc h o s e n D B M S . S o m eti m e s
conceptualschemaiscalledlogicalschemain
Relati onalDataModel.
E ntity

● An en tity can bearea l-wor l dob jec t ,eit heran imateor


inanimate,thatcanbeeasilyidenti fi able.Forexample,ina
s c h o ldatabase,students,teachers,clases,andcourses
ofe re d ca n b e con s i d e re d a s e nti ti e s . A l t h e s e e nti ti e s h ave
someatributesorproperti esthatgivethem t h e i r i d e n ti t y.
● A n e n t i t y s e t i s a c o l e c ti o n o fs i m i l a r t y p e s o fe n ti ti e s . A n
enti t yset maycontai nenti ti eswi t hat r ib utesha ri ngsimi la r
va l u e s . Fo rexa m p l e , a S t u d e n t s s e t m ayc o n ta i n a l t h e
s t u d e n t s o f a s c h o l ; l i ke w i s e a Te a c h e r s s e t m a y c o n t a i n a l
t h e t e a c h e r s o f a s c h o l f r o m a l f a c u l ti e s . E n ti t y s e t s n e d
notbedisjoint.
Att ributes

● Enti ti esarerepresentedbymeansoft heirproperti es,called


at r i b u te s . A l l at r i b u te sh ave va l u e s. Fo rexa m p l e , a st u d e nt
e n ti t y m a y h a v e n a m e , c l a s , a n d a g e a s a t r i b u t e s .
● T h e r e ex i s t s a d o m a i n o r ra n g e o f va l u e s t h a t c a n b e a s i g n e d
to atr ib ute s .Fo rexa m p le ,ast ude nt 'sna m e ca n o t b e a
num e r ic va l ue . It ha stob e al ph ab eti c . Ast ude nt 'sage ca n o t
b e n e ga ti v e , e t c .
T ypes of Attributes


S i m p l e a t r i b u t e − S i m p l e a t r i b u t e s a r e a t o m i c va l u e s , w h i c h c a n o t b e d i v i d e d f u r t h e r. F o r
exa m p l e , a s t u d e n t ' s p h o n e n u m b e r i s a n a to m i c va l u e o f 1 0 d i g i t s .
● Compositeatribute−Compositeatributesaremadeofmorethanonesimpleatribute.For
example,astudent'scompletenamemayhavefi rst_nameandlast_name.
● D e r i v e d a t r i b u t e − D e r i v e d a t r i b u t e s a r e t h e a t r i b u t e s t h a t d o n o t e x i s ti n t h e p hy s i c a l
database,butt heir valuesarederivedfrom o t h e ra t r i b u te s p r e s e n ti n t h e d at a b a s e . Fo r
example,average_salaryi nadepartmentshouldnotbesaveddirect lyinthedatabase,insteadit
ca nbederi ved. Fora not herexampl e, a gecanbederi vedf rom data_of_birth.
● S i n g l e-va l u e at r i bu te −S i ng l e-va l ue at r i b ute s co nta i ns i ng l eva l u e . Fo rexa m pl e −
Social_Security_Number.
● M u l ti va l u e d at r i bu te − M u l ti va l u e d at r i b u te s m ayco nta i n m o ret h a n o n e va l u e s . Fo rexa m p l e ,
a pers onca nhave mo ret ha nonephonenumber,ema i l _a d r e s , e t c .
E n ti t y- S e t a n d K e y s

Key i s an attribute or collection of attributes that uniquely identifies an entity


among entity set. For example, the roll_number of a student makes
him/her identifiable among students.

There are mainly three types of keys:


S u p e r K e y − A set of attributes (one or more) that collectively identifies
an entity in an entity set.
● CandidateKey − A minimal super key is called a candidate key. An entity
set
● may have more than one candidate key.
P r i m a r y Ke y − A primary key is one of the candidate keys chosen by the
database designer to uniquely identify the entity set.
Relati onship
T h e a s o c i a ti o n a m o n g e n ti ti e si s ca l e d a re l a ti o n sh i p. F o rexa m p l e , a n e m p l oye w o r k s _ a t a
d e p a r t m e n t , a st u d e n te n ro l si n a co u rse . H e re ,Wo r ks_ ata n d E n ro l s a re ca l e d re l a ti o n s h i p s.


Re l ati o n sh i p S et : A se to f re l a ti o n s h i ps o fsi m i l a r t y p e i sca l e d a re l a ti o n s h i p s et . L i ke e n ti ti e s, a
relati onshipto canhaveatt ributes.Theseatt ributesareca leddescripti veatt ributes.

D e g r e ofRelati onship:Thenumberofparti cipati ngenti ti esinarelati onshipdefi nesthedegre o f
th ere lati o n sh ip .
Binary=degre 2
Te r n a r y = d e g r e 3
n-ary=degre
M a p ingCardinaliti es

Cardinalitydefi nesthenumberofenti ti esinone


e n ti t y s e t , w h i c h c a n b e a s o c i a t e d w i t h t h e
numberofenti ti esofothersetviarelati onship
set.
T ypes of C ardinalities

1.One-to-one 2.One-to-many
Oneenti tyfrom e n ti t y s e t A c a n b e a s o c i a t e d w i t h m o r e
thanoneenti ti esofenti tysetBhoweveranenti tyfrom
Oneenti tyfrom e n ti t y s e t A c a n b e e n ti t y s e t B, c a n b e a s o c i a t e d w i t h a t m o s t o n e e n ti t y
a s o c i a t e d w i t h a t m o s t o n e e n ti t y
o f e n ti t y s e t B a n d v i c e v e r s a .
TypesofCardinaliti es(cont… . )


ManytoOne
Morethanoneenti ti esfrom e n ti t y s e t A c a n
b e a s o c i a t e d w i t h a t m o s t o n e e n ti t y o f
enti tysetB,howeveranenti tyfrom e n ti t y
setBcanbeasociatedwithmorethanone
enti tyfrom e n ti t y s e t A .

● ManytoMany
Oneenti tyfrom A c a n b e a s o c i a t e d
withmoreth anoneenti ty from B
andviceversa.
2 . E N T I T Y R E L AT I O N S H I P D I A G R A M

● Introducti on
● S ymbols & Notations
● I n f o r m a ti o n E n g i n e r i n g S t y l e U s e d i n E R -
Diagram
I ntroduction

ER-Diagram
isavisual
representati onofdata
thatdescribeshow
dataisrelatedtoeach
o t h e r.
S Y M B O L S A N D N O TAT I O N S

● E n ti ti e s : A n e n ti t y i s a n o b j e c t o r
co nce ptabo u twhi chyo uwa ntt osto rei nfo rm ati o n .

A w e a k e n t i t y i s a n e n ti t y t h a t m u s t
defi nedbyaforeignkeyrelati onshipwi th
a n o t h e re n ti t ya s i t c a n o t b e u n i q u e l y i d e n ti fi e d b y i t s
ow n att ri b u te s a l o ne .
S Y M B O L S A N D N O TAT I O N S ( c o n t … . )

● Acti ons:Acti onsarerepresentedby


d ia mo n d s h a p e , a n d s h owh ow two,
entities share information in the database.

I n s o m e c a s e s , e nti ti e s ca n b e
S e l f- l i n ke d .
Forexample,employescansu
per viseotheremployes
S Y M B O L S A N D N O TAT I O N S ( c o n t … . )

● At r i b u te s : At r i b u te s a re re p re s e nte d
b y o va l s . A ke ya t r i b u te i s t h e u n i q u e , d i s ti n g u i s h i n g ATTRIBUT
E
c h a ra c t e r i sti c o ft h e e nti t y.
Fo r e x a m p l e , a n e m p l o y e ' s s o c i a l s e c u r i t y n u m b e r m i g h t b e t h e e m p l o y e ' s ke ya t r i b u t e .

A m u l ti v a l u e d a t r i b u t e c a n h a v e m o r e t h a n o n e v a l u e .
Fo re xa m p l e , a n e m p l o ye e n ti t y c a n h a v e m u l ti p l e s k i l v a l u e s . ATTRIBUT
E

Aderivedatributeisbasedonanotheratribute.
Fo r e xa m p l e , a n e m p l o y e ' s m o n t h l y s a l a r y i s b a s e d o n t h e
e m p l o y e ' s a n u a l s a l a r y. ATTRIBUT
E
S Y M B O L S A N D N O TAT I O N S ( c o n t … . )


C o n e c ti n g l i n e s : S o l i d l i n e s t h a t c o n e c t a t r i b u t e s t o
s h o wt h e re l ati o n s h i ps o fe nti ti e s i nt h e d i a g ra m.


Cardinality:Cardinalit yspecifi eshowmanyinstances
o fa n e n ti t y r e l a te t o o n e i n s t a n c e o fa n o t h e r e n ti t y.
Ordi na li t y i s al socl o se l yl i n ked to card i na li t y.W hi l e
c a r d i n a l i t y s p e c i fi e s t h e o c u r e n c e s o fa r e l a ti o n s h i p ,
ordinalitydescribest herelati onshipaseither
mandator yoropti onal.Inot he r words,cardinalit y
specifi esthemaximum numbe rofre lati onshi psand
ordinalityspecifi estheabsoluteminimum n u m b e r o f
relati onshi ps.
I NF OR MAT I ON E NGI NE E R I NG S T Y L E
USEDINER-DIAGRAM
Relationships (Cardinality and Modality)

S Y MB OL S MEANING
● ● ZeroorMore
● ● OneorMore
● ● One and only One
● ● ZeroorOne
I NF OR MAT I ON E NGI NE E R I NG S T Y L E
USEDINER-DIAGRAM(cont.)
Many - to - One

SYMBOLS MEANING

● A o n e t h r o u g h m a n y n o t a ti o n o n o n e
s id e o fa re lati on s h ip a n d a on e a n d
o n l y o n e o n t h e o t h e r.


● A ze r o t h r o u g h m a n y n o ta ti o n o n o n e
s id e o fa re l ati on s h ip a n d a on e a n d
o n l y o n e o n t h e o t h e r.
● A o n e t h r o u g h m a n y n o t a ti o n o n o n e

s i d e o f a r e l a ti o n s h i p a n d a ze r o o r o n e
n o t a ti o n o n t h e o t h e r.
● A ze r o t h r o u g h m a n y n o ta ti o n o n o n e

s i d e o f a r e l a ti o n s h i p a n d a ze r o o r o n e
n o t a ti o n o n t h e o t h e r.
I NF OR MAT I ON E NGI NE E R I NG S T Y L E
USEDINER-DIAGRAM(cont.)
Many - to - One

SYMBOLS ME ANI NG


● Azerothroughmanyonbothsidesofa
relati onship.
. ● Aonethroughmanyonbothsidesofa
relati onship.

● Azerothroughmanyononesideanda
o n e t h r o u g h m a n y o n t h e o t h e r.
● A o n e a n d o n l y o n e n o t a ti o n o n o n e s i d e
● o f a r e l a ti o n s h i p a n d a ze r o o r o n e o n
t h e o t h e r.
● A o n e a n d o n l y o n e n o t a ti o n o n b o t h

sides
3 . E X T E N D E D F E AT U R E S O F E R D

● Introducti on
● Generalization

● Specializati on
Inheritance
I ntroduction

T h e E R M o d e l h a st h e p o w e ro fex p re s i n g d ata b a s e e nti ti e s i n a c o n c e p t u a l


hierarchicalmanner.Asthehierarchygoesup,itgeneralizestheviewofenti ti es,and
a s w e g o d e p i n t h e h i e ra rc hy, i t g i v e s u s t h e d e t a i l o fe v e r y e n ti t y i n c l u d e d .
Goingupinthisstructureisca ledgeneralizati on,whereenti ti esareclubbedtogether
torepresentamoregeneralizedview.Forexample,aparti cularstudentnamed
Ka b in d r a ca n b e ge n e ra li ze d a lo n g w i t h a l t h e st u d e nt s.T h e e nti t ys h a l b e a st u d e nt ,
andfurther,thestudenti saperson.Thereverseisca ledspecializati onwherea
p e rson isa st u d e nt , an d t h at st u d e nti s Kab in d ra .
Generalization
I n ge ne ra li zati o n ,a n u mb e ro f
enti ti esarebroughtt ogetherinto
onegeneralizedenti tybasedon
theirsimilarcharacteristi cs.For
Mukesh Gopal
example:Kabindra,Mukesh,Gopal,
S h i v C h a n d ra c a n a l b e ge n e ra l i ze d
ShivChandra
a s m e m b e r o ft h i s G r o u p . Kabindra

Members of this group


Specialization
Specializati onistheoppositeofgeneralizati on.In
speciali zati o n,agro upo fenti ti esisdi vid ed into sub -
groupsbasedontheircharacteristi cs.Takeagroup
‘Perso n ’ fo rexam p le . Ap e rso n h asn am e ,d ate o f PERSON
b i rt h , ge n d e r, etc.Th esep ro p erti e sare co m m o n i n a l
persons,humanbeings.Buti nacompany,persons
canbeidenti fi edasemployee,employer,customer,or
ven d o r, b ased o nwh atro l et h eyp l ay int h e co mp a ny.
IS A

STUDENT TEACHER
Inheritance

We u s e a l t h e a b o v e f e a t u r e s o f E R - M o d e l i n o r d e r t o AGE
NAME GENDER
createclassesofobjectsi nobje ct-ori entedprogramming.
T h e d e t a i l s o fe n ti ti e s a r e g e n e ra l y h i d e n f ro m t h e u s e r ;
t h i s p ro c e s s k n o w n a s a b st ra c ti o n .
Inheritanceisanimportantf eatureofGeneralizati onand
Specializati on.Ita l owsl ower-l eve lenti ti estoinheritt he
PERSON
at ri bu te s ofh i gh e r-l eve l e nti ti e s .
Forexample,theatri butesofaPersoncl as ssuchas
n ame , age ,a nd ge n d e rca n b e i nh e r i te d by l o we r- l eve l
e n ti ti e s s u c h a s S t u d e n t o r Te a c h e r. IS A

STUDENT TEACHER

ROLL NO. ID NO.


Conclusion

So,inthispresentati on,westudiedaboutData
Modelsanditsparts,i.eEnti tyRelati onship
Models,Enti tyRelati onshipDiagram a n d i t s
ExtendedFeatures.Besidethis,wealsolearn
a b o u tt h e u s e o ft h e m indatabasesystem t h e
applicati on,whichtheinformati ontechnology
fi e l d u s e a s o n e o ft h e m a j o r s o ft w a r e i n
co m p u te r fi e l d .
THANKYOU

A N YQ U E RY ? ? ?