SlideShare a Scribd company logo
1 of 9
Download to read offline
Eng.Samir Sabry
IT Instructor
Before of all we must learn and know Entit-Relaionship notation:-
We start by this example: Company database
The Company assigns an employee to one department but may work on several projects,
which are not necessarily controlled by the same department. It keeps track of the number of
hours per week that an employee works on each project. It records the direct supervisor of
each employee. It stores the dependants of each employee for insurance purposes. It keeps
each dependant’s: name, gender, birth date, and relationship to employee
Mapping Rules
Step 1: For each regular entity types
Create a new relation that includes Simple attributes
 For a composite attribute include only the simple component attributes
 Leave out multivalued attributes (to step 6)
 Pick a PK
 For example, we create the relations EMPLOYEE, DEPARTMENT, and
PROJECT for the regular entity types
 Then, we choose SSN, DNUMBER and PNUMBER as primary keys for the
relations EMPLOYEE, DEPARTMENT, and PROJECT, respectively.
 Note: Foreign keys are not included yet.
Step 2: weak entity types
Note: Weak entity type has no key - Related to an identifying or owner
entity type. Has total participation constraint with identifying entity.
 Create a new relation with simple attributes
 Include an FK to the owner entity's relation
 For example, we create the relation DEPENDENT in this step.
 Include the primary key SSN of the EMPLOYEE as a foreign key attribute of
DEPENDENT.
 The primary key of DEPENDENT is the combination {ESSN, DEPENDENT_NAME}
because DEPENDENT_NAME is the partial key of DEPENDENT.
Step 3: 1:1 relationship types
Add to one of the participating relations an FK to the other relation:
 It is better to add to a relation that has total participation in the relationship
 Include any relationship attributes
 Note: When both participations are total, we may merge the two entity types
and the relationship into a single relation.
 Let’s consider the relationship type MANAGES which is total.
 Include the primary key of EMPLOYEE as foreign key in the DEPARTMENT and
rename it as MGRSSN.
 Include the simple attribute StartDate of the MANAGES in the DEPARTMENT
and rename it MGRSTARTDATE.
Step 4: 1: N relationship types
 Add to the relation on the N-side an FK to the other relation.
 Include any relation attributes
 Let’s consider the 1:N relationships type WORKS_FOR, CONTROLS and
SUPERVISION.
 For SUPERVISION, include the primary key SSN of EMPLOYEE as foreign key
in itself and call it SUPERSSN.
 For WORKS_FOR, include the primary key DNUMBER of DEPARTMENT as
foreign key in EMPLOYEE and call it DNO.
 For CONTROLS, include the primary key DNUMBER of DEPARTMENT as
foreign key in PROJECT and call it DNUM
Step 5: M: N relationship types
 Create a New relation containing as FK of the primary keys of
both entity types participating relations
 Include any relation attributes
 Let consider the M:N relationship type WORKS_ON.
 Include the primary keys of the PROJECT and EMPLOYEE relations as
foreign keys in WORKS_ON and rename them PNO and ESSN, respectively.
 Include an attribute HOURS in WORKS_ON.
Step 6: multi-valued attribute
Create new relation for each multi-valued attribute containing FK of the
PK from the Entity
 Let’s consider the attribute DLOCATION.
 Create a relation DEPT_LOCATIONS.
 The primary key of DEPT_LOCATIONS is the combination of {DNUMBER,
DLOCATION}.
Step 7: ternary relationship types
 Create new relation containing a FK referencing each of the 3
entities involved
 Include any relation attributes
Final result:
Notes: How many relations?
1. Entity (both regular and weak)
2. M:N relationship
3. Multi-valued attribute
4. Ternary relationship

More Related Content

What's hot

Visual basic 6.0
Visual basic 6.0Visual basic 6.0
Visual basic 6.0
sanket1996
 
Introduction to visual basic programming
Introduction to visual basic programmingIntroduction to visual basic programming
Introduction to visual basic programming
Roger Argarin
 

What's hot (20)

introduction to visual basic PPT.pptx
introduction to visual basic PPT.pptxintroduction to visual basic PPT.pptx
introduction to visual basic PPT.pptx
 
For Loops and Nesting in Python
For Loops and Nesting in PythonFor Loops and Nesting in Python
For Loops and Nesting in Python
 
Visual programming lecture
Visual programming lecture Visual programming lecture
Visual programming lecture
 
Ambiguity measures in requirements engineering
Ambiguity measures in requirements engineeringAmbiguity measures in requirements engineering
Ambiguity measures in requirements engineering
 
File handling in C
File handling in CFile handling in C
File handling in C
 
Fundamentals of Language Processing
Fundamentals of Language ProcessingFundamentals of Language Processing
Fundamentals of Language Processing
 
Visual basic 6.0
Visual basic 6.0Visual basic 6.0
Visual basic 6.0
 
Windows form application - C# Training
Windows form application - C# Training Windows form application - C# Training
Windows form application - C# Training
 
Introduction to visual basic programming
Introduction to visual basic programmingIntroduction to visual basic programming
Introduction to visual basic programming
 
Assembler
AssemblerAssembler
Assembler
 
Structure
StructureStructure
Structure
 
Python programs - PPT file (Polytechnics)
Python programs - PPT file (Polytechnics)Python programs - PPT file (Polytechnics)
Python programs - PPT file (Polytechnics)
 
form dengan FormMDI Delphi 7
form dengan FormMDI Delphi 7form dengan FormMDI Delphi 7
form dengan FormMDI Delphi 7
 
Object oriented programming in python
Object oriented programming in pythonObject oriented programming in python
Object oriented programming in python
 
Editor structure
Editor structureEditor structure
Editor structure
 
Ch09
Ch09Ch09
Ch09
 
Event driven theory
Event driven theoryEvent driven theory
Event driven theory
 
Visual basic
Visual basicVisual basic
Visual basic
 
Mengoperasikan Aplikasi Perangkat Lunak
Mengoperasikan Aplikasi Perangkat LunakMengoperasikan Aplikasi Perangkat Lunak
Mengoperasikan Aplikasi Perangkat Lunak
 
Corso di scratch - lezione 1
Corso di scratch - lezione 1Corso di scratch - lezione 1
Corso di scratch - lezione 1
 

Similar to Mapping example

Web app development_database_design_er-mapping_12
Web app development_database_design_er-mapping_12Web app development_database_design_er-mapping_12
Web app development_database_design_er-mapping_12
Hassen Poreya
 
FIXED INCOMEModule 3 Group Homework1. [6pts] Given a fiv
FIXED INCOMEModule 3 Group Homework1. [6pts] Given a fivFIXED INCOMEModule 3 Group Homework1. [6pts] Given a fiv
FIXED INCOMEModule 3 Group Homework1. [6pts] Given a fiv
ShainaBoling829
 
Data modeling using the entity relationship model
Data modeling using the entity relationship modelData modeling using the entity relationship model
Data modeling using the entity relationship model
Jafar Nesargi
 

Similar to Mapping example (20)

Web app development_database_design_er-mapping_12
Web app development_database_design_er-mapping_12Web app development_database_design_er-mapping_12
Web app development_database_design_er-mapping_12
 
Mapping
MappingMapping
Mapping
 
ERD with complete knowledge
ERD with complete knowledgeERD with complete knowledge
ERD with complete knowledge
 
ER to relational Mapping: Data base design using ER to relational language. C...
ER to relational Mapping: Data base design using ER to relational language. C...ER to relational Mapping: Data base design using ER to relational language. C...
ER to relational Mapping: Data base design using ER to relational language. C...
 
database1
database1database1
database1
 
FIXED INCOMEModule 3 Group Homework1. [6pts] Given a fiv
FIXED INCOMEModule 3 Group Homework1. [6pts] Given a fivFIXED INCOMEModule 3 Group Homework1. [6pts] Given a fiv
FIXED INCOMEModule 3 Group Homework1. [6pts] Given a fiv
 
free Video lecture in India
free Video lecture in Indiafree Video lecture in India
free Video lecture in India
 
ER to Relational Mapping
ER to Relational MappingER to Relational Mapping
ER to Relational Mapping
 
Ch 5 Presentation
Ch 5 PresentationCh 5 Presentation
Ch 5 Presentation
 
Ch 5 Presentation
Ch 5 PresentationCh 5 Presentation
Ch 5 Presentation
 
Top schools in india
Top schools in indiaTop schools in india
Top schools in india
 
Mapping rules
Mapping rulesMapping rules
Mapping rules
 
BIS03 Data Modelling - I
BIS03 Data Modelling - IBIS03 Data Modelling - I
BIS03 Data Modelling - I
 
02er
02er02er
02er
 
Jobs manager vs supervisor.pptx
Jobs manager vs supervisor.pptxJobs manager vs supervisor.pptx
Jobs manager vs supervisor.pptx
 
DBMS PPT
DBMS PPTDBMS PPT
DBMS PPT
 
Er diagrams
Er diagramsEr diagrams
Er diagrams
 
03 Ch3 Notes Revised
03 Ch3 Notes Revised03 Ch3 Notes Revised
03 Ch3 Notes Revised
 
Data modeling using the entity relationship model
Data modeling using the entity relationship modelData modeling using the entity relationship model
Data modeling using the entity relationship model
 
Chapter3
Chapter3Chapter3
Chapter3
 

More from Samir Sabry

More from Samir Sabry (14)

Mapping example
Mapping exampleMapping example
Mapping example
 
Normalization
NormalizationNormalization
Normalization
 
Keyboard symbols
Keyboard symbolsKeyboard symbols
Keyboard symbols
 
Xhtml
XhtmlXhtml
Xhtml
 
Normlaization
NormlaizationNormlaization
Normlaization
 
Data mining
Data miningData mining
Data mining
 
Data warehouse
Data warehouseData warehouse
Data warehouse
 
2010 Calendriersexy
2010 Calendriersexy2010 Calendriersexy
2010 Calendriersexy
 
Sample Test Word Intermediate Mulitple Choice
Sample Test Word Intermediate Mulitple ChoiceSample Test Word Intermediate Mulitple Choice
Sample Test Word Intermediate Mulitple Choice
 
Computer Fundamentals Test
Computer Fundamentals TestComputer Fundamentals Test
Computer Fundamentals Test
 
Database Management System And Design Questions
Database Management System And Design QuestionsDatabase Management System And Design Questions
Database Management System And Design Questions
 
Test In Word
Test In WordTest In Word
Test In Word
 
Data Warehouse
Data WarehouseData Warehouse
Data Warehouse
 
Digital Image Processing
Digital Image ProcessingDigital Image Processing
Digital Image Processing
 

Recently uploaded

Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
Chris Hunter
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
MateoGardella
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
SanaAli374401
 

Recently uploaded (20)

Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
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.
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 

Mapping example

  • 1. Eng.Samir Sabry IT Instructor Before of all we must learn and know Entit-Relaionship notation:- We start by this example: Company database The Company assigns an employee to one department but may work on several projects, which are not necessarily controlled by the same department. It keeps track of the number of hours per week that an employee works on each project. It records the direct supervisor of each employee. It stores the dependants of each employee for insurance purposes. It keeps each dependant’s: name, gender, birth date, and relationship to employee
  • 2.
  • 3. Mapping Rules Step 1: For each regular entity types Create a new relation that includes Simple attributes  For a composite attribute include only the simple component attributes  Leave out multivalued attributes (to step 6)  Pick a PK  For example, we create the relations EMPLOYEE, DEPARTMENT, and PROJECT for the regular entity types  Then, we choose SSN, DNUMBER and PNUMBER as primary keys for the relations EMPLOYEE, DEPARTMENT, and PROJECT, respectively.  Note: Foreign keys are not included yet.
  • 4. Step 2: weak entity types Note: Weak entity type has no key - Related to an identifying or owner entity type. Has total participation constraint with identifying entity.  Create a new relation with simple attributes  Include an FK to the owner entity's relation  For example, we create the relation DEPENDENT in this step.  Include the primary key SSN of the EMPLOYEE as a foreign key attribute of DEPENDENT.  The primary key of DEPENDENT is the combination {ESSN, DEPENDENT_NAME} because DEPENDENT_NAME is the partial key of DEPENDENT.
  • 5. Step 3: 1:1 relationship types Add to one of the participating relations an FK to the other relation:  It is better to add to a relation that has total participation in the relationship  Include any relationship attributes  Note: When both participations are total, we may merge the two entity types and the relationship into a single relation.  Let’s consider the relationship type MANAGES which is total.  Include the primary key of EMPLOYEE as foreign key in the DEPARTMENT and rename it as MGRSSN.  Include the simple attribute StartDate of the MANAGES in the DEPARTMENT and rename it MGRSTARTDATE.
  • 6. Step 4: 1: N relationship types  Add to the relation on the N-side an FK to the other relation.  Include any relation attributes  Let’s consider the 1:N relationships type WORKS_FOR, CONTROLS and SUPERVISION.  For SUPERVISION, include the primary key SSN of EMPLOYEE as foreign key in itself and call it SUPERSSN.  For WORKS_FOR, include the primary key DNUMBER of DEPARTMENT as foreign key in EMPLOYEE and call it DNO.  For CONTROLS, include the primary key DNUMBER of DEPARTMENT as foreign key in PROJECT and call it DNUM
  • 7. Step 5: M: N relationship types  Create a New relation containing as FK of the primary keys of both entity types participating relations  Include any relation attributes  Let consider the M:N relationship type WORKS_ON.  Include the primary keys of the PROJECT and EMPLOYEE relations as foreign keys in WORKS_ON and rename them PNO and ESSN, respectively.  Include an attribute HOURS in WORKS_ON.
  • 8. Step 6: multi-valued attribute Create new relation for each multi-valued attribute containing FK of the PK from the Entity  Let’s consider the attribute DLOCATION.  Create a relation DEPT_LOCATIONS.  The primary key of DEPT_LOCATIONS is the combination of {DNUMBER, DLOCATION}.
  • 9. Step 7: ternary relationship types  Create new relation containing a FK referencing each of the 3 entities involved  Include any relation attributes Final result: Notes: How many relations? 1. Entity (both regular and weak) 2. M:N relationship 3. Multi-valued attribute 4. Ternary relationship