SlideShare ist ein Scribd-Unternehmen logo
1 von 32
Downloaden Sie, um offline zu lesen
ER Diagrams
To be discussed:-
 Entity
 Attribute
 Types of Attribute
 Relationship
 ER Diagram Representation
 Generalization
 Specialization
 Inheritance
 Codd’s 12 Rule
 Relational Data Model
 ER Model to Relational Model
Entity
 An entity can be a real-world object, either
animate or inanimate, that can be easily
identifiable. Example : School Database
 Teachers
 Students
 Classes
 Courses offered
Entity set
 An entity set is a collection of similar types of
entities. An entity set may contain entities
with attribute sharing similar values.
Attributes
Entities are represented by means of their properties,
called attributes. All attributes have
values. Example : Student :- Name, Class, Age
Types of Attributes
 Simple attribute − Simple attributes are atomic
values, which cannot be divided further. For
example, a student's phone number is an atomic
value of 10 digits.
 Composite attribute − example, a student's
complete name may have first_name and
last_name.
Types of Attributes Continue…..
 Derived attribute − example, average_salary in a
department should not be saved directly in the database,
instead it can be derived.
 For another example, age can be derived from
data_of_birth.
 Single-value attribute − Single-value attributes contain
single value. example −: Social_Security_Number.
 Multi-value attribute − Multi-value attributes may contain
more than one values.
 Example: a person can have more than one phone
number, email_address, etc.
Relationship
 The association among entities is called
relationship.
 Ex: Employee works_at department
 Ex: Student enrolls in a course
 Relationship Set
A set of relationships of similar type is called a
relationship set. Like entities, a relationship too
can have attributes. These attributes are
called descriptive attributes.
Mapping cardinalities
 Cardinality defines the number of entities in
one entity set, which can be associated with
the number of entities of other set via
relationship set.
 One to one
One to many
Many to one
Many to many
One to One
Entity set A Entity
set B
One to many
Entity set A Entity
set B
Many to one
Entity set A Entity
set B
Many to many
Entity set A Entity
set B
ER Diagram Representation
 Entity
 Attributes
Teacher Student Classes
Studen
t
Nam
e
Roll
Birth_Dat
e
ER Diagram Representation Continue…
 Composite
Studen
t
Nam
e
Roll
Birth_Dat
e
Last
First
ER Diagram Representation Continue…
 Multivalued
Studen
t
Nam
e
Roll
Birth_Dat
e
Last
First
Phone_No
ER Diagram Representation Continue…
 Derived
Studen
t
Nam
e
Roll
Birth_Dat
e
Last
First
Phone_No
Age
ER Diagram Representation Continue…
 Relationship
 Binary Relationship and Cardinality
When two entities participate in a relationship then it
is called Binary Relationship.
Cardinality is the number of instance of an entity from
a relation that can be associated with the relation.
ER Diagram Representation Continue…
 One to One (1:1)
1 1
Example : Person – Passport
Student – Roll-No
Relationshi
p Entity
Entity
ER Diagram Representation Continue…
 One to Many (1:N)
1 N
Example : Mother- Children
Student - Address
Relationshi
p Entity
Entity
ER Diagram Representation Continue…
 Many to One (N:1)
N 1
Example : Students - Teacher
Relationshi
p Entity
Entity
ER Diagram Representation Continue…
 Many to One (M:N)
M N
Example : - Books - Authors
Relationshi
p Entity
Entity
ER Diagram Representation Continue…
 Participation Constraint
Total participation Partial participation
Relationshi
p Entity
Entity
 The ER Model has the power of expressing
database entities in a conceptual hierarchical
manner. As the hierarchy goes up, it generalizes
the view of entities, and as we go deep in the
hierarchy, it gives us the detail of every entity
included.
Going up in this structure is called Generalization
Reverse is called Specialization
Generalization and Specialization
Generalization
Pigeon
Birds
Peacoc
k
Sparrow
Specialization
Person
Teache
r
Student
IS A
Inheritance
Person
Nam
e
Gende
r
Birth_Dat
e
Teache
r
Student
EMP_ID
Roll
IS A
Relational Data Model
 Relational data model is the primary data model,
which is used widely around the world for data
storage and processing.
 Concepts
 Touple
 Relation Instance
 Relation Schema
 Relation key
 Attribute domain
Key Constraints
 Key constraints
Primary Key
Foreign Key
Candidate Key
Alternate Key
Key Constraints ….
 Key constraints force that −
 in a relation with a key attribute, no two tuples can
have identical values for key attributes.
 a key attribute can not have NULL values.
 Domain constraints
 Every attribute is bound to have a specific range of values.
 Example : Age can not be negative
 Referential integrity constraints
Key Constraints ….
 Referential integrity constraints
Every relation has some conditions that must hold for
it to be a valid relation. These conditions are
called Relational Integrity Constraints.
I If a relation refers to a key attribute of a different or
same relation, then that key element must exist.
ER model to Relational Model
 ER model
 Entity
 Attributes
 Mapping Entity
 Create table for each entity.
 Entity's attributes should become fields of tables with their
respective data types.
 Declare primary key.
ER model to Relational Model
 Mapping Relationship
 Create table for a relationship.
 Add the primary keys of all participating Entities as
fields of table with their respective data types.
 If relationship has any attribute, add each attribute
as field of table.
 Declare a primary key composing all the primary
keys of participating entities.
 Declare all foreign key constraints.
ER model to Relational Model
 Mapping Weak entity set
 Create table for weak entity set.
 Add all its attributes to table as field.
 Add the primary key of identifying entity set.
 Declare all foreign key constraints.

Weitere ähnliche Inhalte

Ähnlich wie erdiagramspresentation-150826044953-lva1-app6891.pdf

Ähnlich wie erdiagramspresentation-150826044953-lva1-app6891.pdf (20)

Lecture one db
Lecture one dbLecture one db
Lecture one db
 
ER Diagram_Kameshwari.docx
ER Diagram_Kameshwari.docxER Diagram_Kameshwari.docx
ER Diagram_Kameshwari.docx
 
dbms mannual.pdf
dbms mannual.pdfdbms mannual.pdf
dbms mannual.pdf
 
ER MODEL.pptx
ER MODEL.pptxER MODEL.pptx
ER MODEL.pptx
 
ER DIAGRAM & ER MODELING IN DBMS
ER DIAGRAM & ER MODELING IN DBMSER DIAGRAM & ER MODELING IN DBMS
ER DIAGRAM & ER MODELING IN DBMS
 
Fundamentals of database system - Data Modeling Using the Entity-Relationshi...
Fundamentals of database system  - Data Modeling Using the Entity-Relationshi...Fundamentals of database system  - Data Modeling Using the Entity-Relationshi...
Fundamentals of database system - Data Modeling Using the Entity-Relationshi...
 
Data Modeling Er
Data Modeling ErData Modeling Er
Data Modeling Er
 
Database
DatabaseDatabase
Database
 
Sree Dattha Institute of Engineering and Science
Sree Dattha Institute of Engineering and ScienceSree Dattha Institute of Engineering and Science
Sree Dattha Institute of Engineering and Science
 
Db lec 02_new
Db lec 02_newDb lec 02_new
Db lec 02_new
 
ERD(2).ppt
ERD(2).pptERD(2).ppt
ERD(2).ppt
 
Er model
Er modelEr model
Er model
 
RDBMS ERD
RDBMS ERDRDBMS ERD
RDBMS ERD
 
E_R-Diagram (2).pptx
E_R-Diagram (2).pptxE_R-Diagram (2).pptx
E_R-Diagram (2).pptx
 
Entity Relationship Modelling
Entity Relationship ModellingEntity Relationship Modelling
Entity Relationship Modelling
 
Entity Relationship Diagram2
Entity Relationship Diagram2Entity Relationship Diagram2
Entity Relationship Diagram2
 
E r model
E r modelE r model
E r model
 
Rdbms ER model
Rdbms ER modelRdbms ER model
Rdbms ER model
 
Data modeling
Data modelingData modeling
Data modeling
 
database
databasedatabase
database
 

Kürzlich hochgeladen

Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 

Kürzlich hochgeladen (20)

Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 

erdiagramspresentation-150826044953-lva1-app6891.pdf

  • 2. To be discussed:-  Entity  Attribute  Types of Attribute  Relationship  ER Diagram Representation  Generalization  Specialization  Inheritance  Codd’s 12 Rule  Relational Data Model  ER Model to Relational Model
  • 3. Entity  An entity can be a real-world object, either animate or inanimate, that can be easily identifiable. Example : School Database  Teachers  Students  Classes  Courses offered Entity set  An entity set is a collection of similar types of entities. An entity set may contain entities with attribute sharing similar values.
  • 4. Attributes Entities are represented by means of their properties, called attributes. All attributes have values. Example : Student :- Name, Class, Age Types of Attributes  Simple attribute − Simple attributes are atomic values, which cannot be divided further. For example, a student's phone number is an atomic value of 10 digits.  Composite attribute − example, a student's complete name may have first_name and last_name.
  • 5. Types of Attributes Continue…..  Derived attribute − example, average_salary in a department should not be saved directly in the database, instead it can be derived.  For another example, age can be derived from data_of_birth.  Single-value attribute − Single-value attributes contain single value. example −: Social_Security_Number.  Multi-value attribute − Multi-value attributes may contain more than one values.  Example: a person can have more than one phone number, email_address, etc.
  • 6. Relationship  The association among entities is called relationship.  Ex: Employee works_at department  Ex: Student enrolls in a course  Relationship Set A set of relationships of similar type is called a relationship set. Like entities, a relationship too can have attributes. These attributes are called descriptive attributes.
  • 7. Mapping cardinalities  Cardinality defines the number of entities in one entity set, which can be associated with the number of entities of other set via relationship set.  One to one One to many Many to one Many to many
  • 8. One to One Entity set A Entity set B
  • 9. One to many Entity set A Entity set B
  • 10. Many to one Entity set A Entity set B
  • 11. Many to many Entity set A Entity set B
  • 12. ER Diagram Representation  Entity  Attributes Teacher Student Classes Studen t Nam e Roll Birth_Dat e
  • 13. ER Diagram Representation Continue…  Composite Studen t Nam e Roll Birth_Dat e Last First
  • 14. ER Diagram Representation Continue…  Multivalued Studen t Nam e Roll Birth_Dat e Last First Phone_No
  • 15. ER Diagram Representation Continue…  Derived Studen t Nam e Roll Birth_Dat e Last First Phone_No Age
  • 16. ER Diagram Representation Continue…  Relationship  Binary Relationship and Cardinality When two entities participate in a relationship then it is called Binary Relationship. Cardinality is the number of instance of an entity from a relation that can be associated with the relation.
  • 17. ER Diagram Representation Continue…  One to One (1:1) 1 1 Example : Person – Passport Student – Roll-No Relationshi p Entity Entity
  • 18. ER Diagram Representation Continue…  One to Many (1:N) 1 N Example : Mother- Children Student - Address Relationshi p Entity Entity
  • 19. ER Diagram Representation Continue…  Many to One (N:1) N 1 Example : Students - Teacher Relationshi p Entity Entity
  • 20. ER Diagram Representation Continue…  Many to One (M:N) M N Example : - Books - Authors Relationshi p Entity Entity
  • 21. ER Diagram Representation Continue…  Participation Constraint Total participation Partial participation Relationshi p Entity Entity
  • 22.  The ER Model has the power of expressing database entities in a conceptual hierarchical manner. As the hierarchy goes up, it generalizes the view of entities, and as we go deep in the hierarchy, it gives us the detail of every entity included. Going up in this structure is called Generalization Reverse is called Specialization Generalization and Specialization
  • 26. Relational Data Model  Relational data model is the primary data model, which is used widely around the world for data storage and processing.  Concepts  Touple  Relation Instance  Relation Schema  Relation key  Attribute domain
  • 27. Key Constraints  Key constraints Primary Key Foreign Key Candidate Key Alternate Key
  • 28. Key Constraints ….  Key constraints force that −  in a relation with a key attribute, no two tuples can have identical values for key attributes.  a key attribute can not have NULL values.  Domain constraints  Every attribute is bound to have a specific range of values.  Example : Age can not be negative  Referential integrity constraints
  • 29. Key Constraints ….  Referential integrity constraints Every relation has some conditions that must hold for it to be a valid relation. These conditions are called Relational Integrity Constraints. I If a relation refers to a key attribute of a different or same relation, then that key element must exist.
  • 30. ER model to Relational Model  ER model  Entity  Attributes  Mapping Entity  Create table for each entity.  Entity's attributes should become fields of tables with their respective data types.  Declare primary key.
  • 31. ER model to Relational Model  Mapping Relationship  Create table for a relationship.  Add the primary keys of all participating Entities as fields of table with their respective data types.  If relationship has any attribute, add each attribute as field of table.  Declare a primary key composing all the primary keys of participating entities.  Declare all foreign key constraints.
  • 32. ER model to Relational Model  Mapping Weak entity set  Create table for weak entity set.  Add all its attributes to table as field.  Add the primary key of identifying entity set.  Declare all foreign key constraints.