SlideShare ist ein Scribd-Unternehmen logo
1 von 30
Data Models
Data Model
• A database model defines the logical design of data.
The model also describes the relationships between
different parts of the data.
• Various types of data models are:
• Object oriented model
• Hierarchical data model
• Relational data model
• Network model
Data Models
• Hierarchical data model: This is called a parent-child
relationship. In this model each entity has only one parent but
several children. At the top of the hierarchy there is only one
entity which is called Root.(one to many relationships and not many
to many relationship)
Data Models
• Network model: In a network DBMS every data item
can be related to many others ones. The database
structure is like a graph. This is similar to the
hierarchical model and also provides a tree-like
structure. However, a child is allowed to have more
than one parent.
Data Models
• Relational data model: In relational data model,
data exists in two dimensional tables known as
relations. A relation (table) consists of unique
attributes (columns) and tuples (rows).
Data Models
• Object oriented model: Object based data models
use concepts such as entities, attributes, and
relationships
• The entity relational model( E-R model) has emerged
as one of the main techniques for modeling database
design .
E-R Model
• ER Model is based on:
Entities and their attributes
Relationships among entities
E-R Model components
• Entity: An entity in ER Model is real world entity, which has some
properties called attributes. Every attribute is defined by its set of
values, called domain. For example, in a school database, a student is
considered as an entity. Student has various attributes like name, age
and class etc.
• An entity set is a collection of similar types of entities. For example,
Students set may contain all the student of a school.
Attributes
• Attributes describe the properties of the entity of which
they are associated.
• A particular instance of an attribute is a value. For
example, "Ram" is one value of the attribute Name.
• We can classify attributes as following:
¨ Simple-cannot be further subdivided eg:Age,salary
¨ Composite-can be further subdivided eg:name
(first,last)
¨ Single-valued- eg:room number
¨ Multi-valued- eg:hobby attribute-reading,movies
¨ Derived- whose value is derived from the value of
some other attribute eg: age is derived from date-of-birth
E-R Model: Symbols and notations
E-R Model: Symbols and notations
E-R Model
• Relationship: The association among entities is called
relationship. For example, employee entity has
relation works_at with department.
• Relationships are mapped with entities in various
ways. Mapping cardinalities define the number of
association between two entities.
Constraints
• Various types of constraints are:
1. Mapping cardinalities
2. Participation constraints
3. Keys
Mapping Cardinalities
• Mapping cardinality or cardinality ratios , express the number of
entities to which another entity can be associated via a relationship
set
• Mapping cardinalities:
• one to one
• one to many
• many to one
• many to many
• One-to-one: one entity from entity set A can be
associated with at most one entity of entity set B and
vice versa.
• One-to-many: One entity from entity set A can be
associated more than one entities of entity set B but
from entity set B one entity can be associated with at
most one entity.
• Many-to-one: More than one entities from entity set A
can be associated with at most one entity of entity set B
but one entity from entity set B can be associated with
more than one entity from entity set A.
• Many-to-many: one entity from A can be associated with
more than one entity from B and vice versa.
Participation Constraints
• The participation of an entity set E in a relationship set R is said to be
total if every entity in E participates in at least one relationship in R.
(eg department is entity and head_of is relationship)
• If only some entities in E participate in relationships in R, the
participation is said to be partial. (eg: not every employee is head_of
deparment)
Keys
• The key is defined as the column or attribute of the database table.
• They are used to establish and identify relation between tables.
• They also ensure that each record within a table can be uniquely
identified by combination of one or more fields within a table.
Example
Total participation of Loan entity
Types of Keys
1. Superkey: An attribute (or combination of
attributes) that uniquely identifies each row in a
table. It is a super set of candidate
key.(eg:roll_no,name)
2. Candidate key : An attribute (or set of attributes)
that uniquely identifies a row. Let K be a set of
attributes of relation R. Then K is a candidate key
for R if it possess the following properties:
1. Uniqueness – No legal value of R ever contains two
distinct tuples with the same value of K
2. Irreducibility- No proper subset of K has the uniqueness
property
Types of Keys
3. Primary key : is the candidate key which is selected as the principal
unique identifier. It is a key that uniquely identify each record in the
table. Cannot contain null entries.
Types of Keys
4. Composite Key: Key that consist of two or more attributes that
uniquely identifies an entity occurrence is called composite key.
Reg_no Crs_id subjects
Types of Keys
5. Foreign Key: A foreign key is the attribute of a table which refers to
the primary key of another table. It permits only those values which
appears in the primary key of table to which it refers or may be null.
In other words, if we had a table A with a primary key X that linked to a
table B where X was a field in B, then X would be a foreign key in B.
Example
Steps in designing E-R Diagram
• There are following steps:
• Identify the entities from the requirement sheets
• Find relationships among those entities
• Identify the key attributes for every entity
• Identify other relevant attributes
• Draw complete E-R diagram with all attributes including Primary key
• Review your results with your Business users
Example: University Management
System
poll
• Teach in this E-R diagram is an entity?
• Yes
• no
Strong and Weak entity sets
• The entity set which does not have sufficient attributes to form a
primary key is called a Weak entity set.
• The entity set which has the primary key is called as Strong entity set.
• A member of a strong entity set is called dominant entity and
member of a weak entity set is called subordinate entity.
• Weak entity does not have a primary key but we need a mean to
distinguish among other entities. The discriminator of a weak entity
set is a set of attributes that allows this distinction to be made. Ex:
payment_number.
Example
Roles
• Entity sets of a relationship need not be distinct
• The labels “manager” and “worker” are called roles; they
specify how employee entities interact via the works_for
relationship set.
• Roles are indicated in E-R diagrams by labeling the lines that
connect diamonds to rectangles.
• Role labels are optional

Weitere ähnliche Inhalte

Ähnlich wie Data Models.pptx

Ähnlich wie Data Models.pptx (20)

ERD(2).ppt
ERD(2).pptERD(2).ppt
ERD(2).ppt
 
ER-Model-ER Diagram
ER-Model-ER DiagramER-Model-ER Diagram
ER-Model-ER Diagram
 
er-models.pptx
er-models.pptxer-models.pptx
er-models.pptx
 
Presentation of saad on e-r diagram.
Presentation of saad on e-r diagram.Presentation of saad on e-r diagram.
Presentation of saad on e-r diagram.
 
ER Modeling and Introduction to RDBMS
ER Modeling and Introduction to RDBMSER Modeling and Introduction to RDBMS
ER Modeling and Introduction to RDBMS
 
ER-Diagram.pptx
ER-Diagram.pptxER-Diagram.pptx
ER-Diagram.pptx
 
rdbmsdol.pptx
rdbmsdol.pptxrdbmsdol.pptx
rdbmsdol.pptx
 
rdbmsdol.pptx
rdbmsdol.pptxrdbmsdol.pptx
rdbmsdol.pptx
 
ER MODEL.pptx
ER MODEL.pptxER MODEL.pptx
ER MODEL.pptx
 
Data Models
Data ModelsData Models
Data Models
 
Databases - Unit 2.pdf
Databases - Unit 2.pdfDatabases - Unit 2.pdf
Databases - Unit 2.pdf
 
RDBMS ERD
RDBMS ERDRDBMS ERD
RDBMS ERD
 
Database design
Database designDatabase design
Database design
 
Er model
Er modelEr model
Er model
 
ER Model in DBMS
ER Model in DBMSER Model in DBMS
ER Model in DBMS
 
Entity Relationship Diagram – ER Diagram in DBMS.pptx
Entity Relationship Diagram – ER Diagram in DBMS.pptxEntity Relationship Diagram – ER Diagram in DBMS.pptx
Entity Relationship Diagram – ER Diagram in DBMS.pptx
 
Er diagram
Er diagramEr diagram
Er diagram
 
E_R-Diagram (2).pptx
E_R-Diagram (2).pptxE_R-Diagram (2).pptx
E_R-Diagram (2).pptx
 
Database Design and Entity relationship Model.pptx
Database Design and Entity relationship Model.pptxDatabase Design and Entity relationship Model.pptx
Database Design and Entity relationship Model.pptx
 
DBMS Unit 2 ppt.ppt
DBMS Unit 2 ppt.pptDBMS Unit 2 ppt.ppt
DBMS Unit 2 ppt.ppt
 

Mehr von CheriviralaNikhil

Mehr von CheriviralaNikhil (6)

A323568347_29695_5_2024_Lecture0_INT232.ppt
A323568347_29695_5_2024_Lecture0_INT232.pptA323568347_29695_5_2024_Lecture0_INT232.ppt
A323568347_29695_5_2024_Lecture0_INT232.ppt
 
Introduction to OS.pdf
Introduction to OS.pdfIntroduction to OS.pdf
Introduction to OS.pdf
 
DPPM V.pdf
DPPM V.pdfDPPM V.pdf
DPPM V.pdf
 
Lecture1-2.ppt
Lecture1-2.pptLecture1-2.ppt
Lecture1-2.ppt
 
UNIT1Lesson 2.pptx
UNIT1Lesson 2.pptxUNIT1Lesson 2.pptx
UNIT1Lesson 2.pptx
 
Storage_classes_and_Scope_rules.pptx
Storage_classes_and_Scope_rules.pptxStorage_classes_and_Scope_rules.pptx
Storage_classes_and_Scope_rules.pptx
 

Kürzlich hochgeladen

Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...SUHANI PANDEY
 
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdfMatthew Sinclair
 
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...roncy bisnoi
 
Pirangut | Call Girls Pune Phone No 8005736733 Elite Escort Service Available...
Pirangut | Call Girls Pune Phone No 8005736733 Elite Escort Service Available...Pirangut | Call Girls Pune Phone No 8005736733 Elite Escort Service Available...
Pirangut | Call Girls Pune Phone No 8005736733 Elite Escort Service Available...SUHANI PANDEY
 
Russian Call Girls Pune (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
Russian Call Girls Pune  (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...Russian Call Girls Pune  (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
Russian Call Girls Pune (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...SUHANI PANDEY
 
Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...
Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...
Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...SUHANI PANDEY
 
APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC
 
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...nilamkumrai
 
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...SUHANI PANDEY
 
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableCall Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableSeo
 
( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...
( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...
( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...nilamkumrai
 
Trump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts SweatshirtTrump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts Sweatshirtrahman018755
 
Real Escorts in Al Nahda +971524965298 Dubai Escorts Service
Real Escorts in Al Nahda +971524965298 Dubai Escorts ServiceReal Escorts in Al Nahda +971524965298 Dubai Escorts Service
Real Escorts in Al Nahda +971524965298 Dubai Escorts ServiceEscorts Call Girls
 
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)Delhi Call girls
 
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge GraphsEleniIlkou
 
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查ydyuyu
 
Real Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtReal Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtrahman018755
 
"Boost Your Digital Presence: Partner with a Leading SEO Agency"
"Boost Your Digital Presence: Partner with a Leading SEO Agency""Boost Your Digital Presence: Partner with a Leading SEO Agency"
"Boost Your Digital Presence: Partner with a Leading SEO Agency"growthgrids
 

Kürzlich hochgeladen (20)

Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
Russian Call Girls in %(+971524965298 )# Call Girls in Dubai
Russian Call Girls in %(+971524965298  )#  Call Girls in DubaiRussian Call Girls in %(+971524965298  )#  Call Girls in Dubai
Russian Call Girls in %(+971524965298 )# Call Girls in Dubai
 
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
 
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
 
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
 
Pirangut | Call Girls Pune Phone No 8005736733 Elite Escort Service Available...
Pirangut | Call Girls Pune Phone No 8005736733 Elite Escort Service Available...Pirangut | Call Girls Pune Phone No 8005736733 Elite Escort Service Available...
Pirangut | Call Girls Pune Phone No 8005736733 Elite Escort Service Available...
 
Russian Call Girls Pune (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
Russian Call Girls Pune  (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...Russian Call Girls Pune  (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
Russian Call Girls Pune (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
 
Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...
Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...
Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...
 
APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53
 
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
 
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
 
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableCall Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
 
( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...
( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...
( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...
 
Trump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts SweatshirtTrump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts Sweatshirt
 
Real Escorts in Al Nahda +971524965298 Dubai Escorts Service
Real Escorts in Al Nahda +971524965298 Dubai Escorts ServiceReal Escorts in Al Nahda +971524965298 Dubai Escorts Service
Real Escorts in Al Nahda +971524965298 Dubai Escorts Service
 
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
 
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
 
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
 
Real Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtReal Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirt
 
"Boost Your Digital Presence: Partner with a Leading SEO Agency"
"Boost Your Digital Presence: Partner with a Leading SEO Agency""Boost Your Digital Presence: Partner with a Leading SEO Agency"
"Boost Your Digital Presence: Partner with a Leading SEO Agency"
 

Data Models.pptx

  • 2. Data Model • A database model defines the logical design of data. The model also describes the relationships between different parts of the data. • Various types of data models are: • Object oriented model • Hierarchical data model • Relational data model • Network model
  • 3. Data Models • Hierarchical data model: This is called a parent-child relationship. In this model each entity has only one parent but several children. At the top of the hierarchy there is only one entity which is called Root.(one to many relationships and not many to many relationship)
  • 4. Data Models • Network model: In a network DBMS every data item can be related to many others ones. The database structure is like a graph. This is similar to the hierarchical model and also provides a tree-like structure. However, a child is allowed to have more than one parent.
  • 5. Data Models • Relational data model: In relational data model, data exists in two dimensional tables known as relations. A relation (table) consists of unique attributes (columns) and tuples (rows).
  • 6. Data Models • Object oriented model: Object based data models use concepts such as entities, attributes, and relationships • The entity relational model( E-R model) has emerged as one of the main techniques for modeling database design .
  • 7. E-R Model • ER Model is based on: Entities and their attributes Relationships among entities
  • 8. E-R Model components • Entity: An entity in ER Model is real world entity, which has some properties called attributes. Every attribute is defined by its set of values, called domain. For example, in a school database, a student is considered as an entity. Student has various attributes like name, age and class etc. • An entity set is a collection of similar types of entities. For example, Students set may contain all the student of a school.
  • 9. Attributes • Attributes describe the properties of the entity of which they are associated. • A particular instance of an attribute is a value. For example, "Ram" is one value of the attribute Name. • We can classify attributes as following: ¨ Simple-cannot be further subdivided eg:Age,salary ¨ Composite-can be further subdivided eg:name (first,last) ¨ Single-valued- eg:room number ¨ Multi-valued- eg:hobby attribute-reading,movies ¨ Derived- whose value is derived from the value of some other attribute eg: age is derived from date-of-birth
  • 10. E-R Model: Symbols and notations
  • 11. E-R Model: Symbols and notations
  • 12. E-R Model • Relationship: The association among entities is called relationship. For example, employee entity has relation works_at with department. • Relationships are mapped with entities in various ways. Mapping cardinalities define the number of association between two entities.
  • 13. Constraints • Various types of constraints are: 1. Mapping cardinalities 2. Participation constraints 3. Keys
  • 14. Mapping Cardinalities • Mapping cardinality or cardinality ratios , express the number of entities to which another entity can be associated via a relationship set • Mapping cardinalities: • one to one • one to many • many to one • many to many
  • 15. • One-to-one: one entity from entity set A can be associated with at most one entity of entity set B and vice versa. • One-to-many: One entity from entity set A can be associated more than one entities of entity set B but from entity set B one entity can be associated with at most one entity.
  • 16. • Many-to-one: More than one entities from entity set A can be associated with at most one entity of entity set B but one entity from entity set B can be associated with more than one entity from entity set A. • Many-to-many: one entity from A can be associated with more than one entity from B and vice versa.
  • 17. Participation Constraints • The participation of an entity set E in a relationship set R is said to be total if every entity in E participates in at least one relationship in R. (eg department is entity and head_of is relationship) • If only some entities in E participate in relationships in R, the participation is said to be partial. (eg: not every employee is head_of deparment)
  • 18. Keys • The key is defined as the column or attribute of the database table. • They are used to establish and identify relation between tables. • They also ensure that each record within a table can be uniquely identified by combination of one or more fields within a table.
  • 20. Types of Keys 1. Superkey: An attribute (or combination of attributes) that uniquely identifies each row in a table. It is a super set of candidate key.(eg:roll_no,name) 2. Candidate key : An attribute (or set of attributes) that uniquely identifies a row. Let K be a set of attributes of relation R. Then K is a candidate key for R if it possess the following properties: 1. Uniqueness – No legal value of R ever contains two distinct tuples with the same value of K 2. Irreducibility- No proper subset of K has the uniqueness property
  • 21. Types of Keys 3. Primary key : is the candidate key which is selected as the principal unique identifier. It is a key that uniquely identify each record in the table. Cannot contain null entries.
  • 22. Types of Keys 4. Composite Key: Key that consist of two or more attributes that uniquely identifies an entity occurrence is called composite key. Reg_no Crs_id subjects
  • 23. Types of Keys 5. Foreign Key: A foreign key is the attribute of a table which refers to the primary key of another table. It permits only those values which appears in the primary key of table to which it refers or may be null. In other words, if we had a table A with a primary key X that linked to a table B where X was a field in B, then X would be a foreign key in B.
  • 25. Steps in designing E-R Diagram • There are following steps: • Identify the entities from the requirement sheets • Find relationships among those entities • Identify the key attributes for every entity • Identify other relevant attributes • Draw complete E-R diagram with all attributes including Primary key • Review your results with your Business users
  • 27. poll • Teach in this E-R diagram is an entity? • Yes • no
  • 28. Strong and Weak entity sets • The entity set which does not have sufficient attributes to form a primary key is called a Weak entity set. • The entity set which has the primary key is called as Strong entity set. • A member of a strong entity set is called dominant entity and member of a weak entity set is called subordinate entity. • Weak entity does not have a primary key but we need a mean to distinguish among other entities. The discriminator of a weak entity set is a set of attributes that allows this distinction to be made. Ex: payment_number.
  • 30. Roles • Entity sets of a relationship need not be distinct • The labels “manager” and “worker” are called roles; they specify how employee entities interact via the works_for relationship set. • Roles are indicated in E-R diagrams by labeling the lines that connect diamonds to rectangles. • Role labels are optional