Mapping example

Samir Sabry
Samir SabryIT Instructor um Samir Sabry

Mapping rules with example

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 example
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

Recomendados

Mapping rules von
Mapping rulesMapping rules
Mapping rulesSamir Sabry
3.8K views1 Folie
ER to relational Mapping: Data base design using ER to relational language. C... von
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...Raj vardhan
464 views4 Folien
World of data @ praxis 2013 v2 von
World of data   @ praxis 2013  v2World of data   @ praxis 2013  v2
World of data @ praxis 2013 v2Prithwis Mukerjee
598 views12 Folien
Data mining classification-2009-v0 von
Data mining classification-2009-v0Data mining classification-2009-v0
Data mining classification-2009-v0Prithwis Mukerjee
1.6K views23 Folien
Data mining clustering-2009-v0 von
Data mining clustering-2009-v0Data mining clustering-2009-v0
Data mining clustering-2009-v0Prithwis Mukerjee
1.1K views14 Folien
Data mining intro-2009-v2 von
Data mining intro-2009-v2Data mining intro-2009-v2
Data mining intro-2009-v2Prithwis Mukerjee
1.1K views62 Folien

Más contenido relacionado

Destacado

05 OLAP v6 weekend von
05 OLAP  v6 weekend05 OLAP  v6 weekend
05 OLAP v6 weekendPrithwis Mukerjee
1.1K views43 Folien
Thought control von
Thought controlThought control
Thought controlPrithwis Mukerjee
591 views16 Folien
Data mining arm-2009-v0 von
Data mining arm-2009-v0Data mining arm-2009-v0
Data mining arm-2009-v0Prithwis Mukerjee
1.8K views42 Folien
Test In Word von
Test In WordTest In Word
Test In WordSamir Sabry
11.3K views12 Folien
Data Science von
Data ScienceData Science
Data SciencePrithwis Mukerjee
1.9K views37 Folien
Keyboard symbols von
Keyboard symbolsKeyboard symbols
Keyboard symbolsSamir Sabry
1.7K views1 Folie

Destacado(20)

Test In Word von Samir Sabry
Test In WordTest In Word
Test In Word
Samir Sabry11.3K views
Keyboard symbols von Samir Sabry
Keyboard symbolsKeyboard symbols
Keyboard symbols
Samir Sabry1.7K views
Sample Test Word Intermediate Mulitple Choice von Samir Sabry
Sample Test Word Intermediate Mulitple ChoiceSample Test Word Intermediate Mulitple Choice
Sample Test Word Intermediate Mulitple Choice
Samir Sabry2.9K views
BIS 08a - Application Development - II Version 2 von Prithwis Mukerjee
BIS 08a - Application Development - II Version 2BIS 08a - Application Development - II Version 2
BIS 08a - Application Development - II Version 2
Prithwis Mukerjee1.2K views
What is Metadata? von Adgistics
What is Metadata?What is Metadata?
What is Metadata?
Adgistics 4.1K views
Bitcoin, Blockchain and the Crypto Contracts - Part 2 von Prithwis Mukerjee
Bitcoin, Blockchain and the Crypto Contracts - Part 2Bitcoin, Blockchain and the Crypto Contracts - Part 2
Bitcoin, Blockchain and the Crypto Contracts - Part 2
Prithwis Mukerjee2.5K views
Computer Fundamentals Test von Samir Sabry
Computer Fundamentals TestComputer Fundamentals Test
Computer Fundamentals Test
Samir Sabry16.5K views
4 Steps to Make Customer Data Actionable von Jean-Michel Franco
4 Steps to Make Customer Data Actionable 4 Steps to Make Customer Data Actionable
4 Steps to Make Customer Data Actionable
Jean-Michel Franco3.2K views
Database Management System And Design Questions von Samir Sabry
Database Management System And Design QuestionsDatabase Management System And Design Questions
Database Management System And Design Questions
Samir Sabry15.2K views
Bitcoin, Blockchain and Crypto Contracts - Part 3 von Prithwis Mukerjee
Bitcoin, Blockchain and Crypto Contracts - Part 3Bitcoin, Blockchain and Crypto Contracts - Part 3
Bitcoin, Blockchain and Crypto Contracts - Part 3
Prithwis Mukerjee1.6K views

Similar a Mapping example

Web app development_database_design_er-mapping_12 von
Web app development_database_design_er-mapping_12Web app development_database_design_er-mapping_12
Web app development_database_design_er-mapping_12Hassen Poreya
603 views18 Folien
Mapping von
MappingMapping
MappingSamir Sabry
1.3K views16 Folien
ERD with complete knowledge von
ERD with complete knowledgeERD with complete knowledge
ERD with complete knowledgeAsma Rasool
341 views96 Folien
database1 von
database1database1
database1Monika Sharma
759 views11 Folien
FIXED INCOMEModule 3 Group Homework1. [6pts] Given a fiv von
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 fivShainaBoling829
2 views33 Folien
free Video lecture in India von
free Video lecture in Indiafree Video lecture in India
free Video lecture in IndiaEdhole.com
300 views40 Folien

Similar a Mapping example(20)

Web app development_database_design_er-mapping_12 von Hassen Poreya
Web app development_database_design_er-mapping_12Web app development_database_design_er-mapping_12
Web app development_database_design_er-mapping_12
Hassen Poreya603 views
ERD with complete knowledge von Asma Rasool
ERD with complete knowledgeERD with complete knowledge
ERD with complete knowledge
Asma Rasool341 views
FIXED INCOMEModule 3 Group Homework1. [6pts] Given a fiv von ShainaBoling829
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
ShainaBoling8292 views
free Video lecture in India von Edhole.com
free Video lecture in Indiafree Video lecture in India
free Video lecture in India
Edhole.com300 views
Top schools in india von Edhole.com
Top schools in indiaTop schools in india
Top schools in india
Edhole.com579 views
Jobs manager vs supervisor.pptx von prosofts1
Jobs manager vs supervisor.pptxJobs manager vs supervisor.pptx
Jobs manager vs supervisor.pptx
prosofts14 views
03 Ch3 Notes Revised von guest6f408c
03 Ch3 Notes Revised03 Ch3 Notes Revised
03 Ch3 Notes Revised
guest6f408c3.4K views
Data modeling using the entity relationship model von Jafar Nesargi
Data modeling using the entity relationship modelData modeling using the entity relationship model
Data modeling using the entity relationship model
Jafar Nesargi10.8K views
Free video lectures for mca von Edhole.com
Free video lectures for mcaFree video lectures for mca
Free video lectures for mca
Edhole.com201 views

Más de Samir Sabry

Mapping example von
Mapping exampleMapping example
Mapping exampleSamir Sabry
4.2K views9 Folien
Xhtml von
XhtmlXhtml
XhtmlSamir Sabry
2.8K views20 Folien
Normlaization von
NormlaizationNormlaization
NormlaizationSamir Sabry
8.8K views27 Folien
Data mining von
Data miningData mining
Data miningSamir Sabry
21.8K views29 Folien
Data warehouse von
Data warehouseData warehouse
Data warehouseSamir Sabry
3.4K views44 Folien
2010 Calendriersexy von
2010 Calendriersexy2010 Calendriersexy
2010 CalendriersexySamir Sabry
314 views16 Folien

Más de Samir Sabry(8)

Último

ICS3211_lecture 09_2023.pdf von
ICS3211_lecture 09_2023.pdfICS3211_lecture 09_2023.pdf
ICS3211_lecture 09_2023.pdfVanessa Camilleri
115 views10 Folien
unidad 3.pdf von
unidad 3.pdfunidad 3.pdf
unidad 3.pdfMarcosRodriguezUcedo
117 views38 Folien
How to empty an One2many field in Odoo von
How to empty an One2many field in OdooHow to empty an One2many field in Odoo
How to empty an One2many field in OdooCeline George
87 views8 Folien
MIXING OF PHARMACEUTICALS.pptx von
MIXING OF PHARMACEUTICALS.pptxMIXING OF PHARMACEUTICALS.pptx
MIXING OF PHARMACEUTICALS.pptxAnupkumar Sharma
95 views35 Folien
Narration lesson plan von
Narration lesson planNarration lesson plan
Narration lesson planTARIQ KHAN
61 views11 Folien
Class 9 lesson plans von
Class 9 lesson plansClass 9 lesson plans
Class 9 lesson plansTARIQ KHAN
51 views34 Folien

Último(20)

How to empty an One2many field in Odoo von Celine George
How to empty an One2many field in OdooHow to empty an One2many field in Odoo
How to empty an One2many field in Odoo
Celine George87 views
Narration lesson plan von TARIQ KHAN
Narration lesson planNarration lesson plan
Narration lesson plan
TARIQ KHAN61 views
Class 9 lesson plans von TARIQ KHAN
Class 9 lesson plansClass 9 lesson plans
Class 9 lesson plans
TARIQ KHAN51 views
Drama KS5 Breakdown von WestHatch
Drama KS5 BreakdownDrama KS5 Breakdown
Drama KS5 Breakdown
WestHatch98 views
Pharmaceutical Inorganic chemistry UNIT-V Radiopharmaceutical.pptx von Ms. Pooja Bhandare
Pharmaceutical Inorganic chemistry UNIT-V Radiopharmaceutical.pptxPharmaceutical Inorganic chemistry UNIT-V Radiopharmaceutical.pptx
Pharmaceutical Inorganic chemistry UNIT-V Radiopharmaceutical.pptx
Ms. Pooja Bhandare113 views
AUDIENCE - BANDURA.pptx von iammrhaywood
AUDIENCE - BANDURA.pptxAUDIENCE - BANDURA.pptx
AUDIENCE - BANDURA.pptx
iammrhaywood117 views
The basics - information, data, technology and systems.pdf von JonathanCovena1
The basics - information, data, technology and systems.pdfThe basics - information, data, technology and systems.pdf
The basics - information, data, technology and systems.pdf
JonathanCovena1146 views
ISO/IEC 27001 and ISO/IEC 27005: Managing AI Risks Effectively von PECB
ISO/IEC 27001 and ISO/IEC 27005: Managing AI Risks EffectivelyISO/IEC 27001 and ISO/IEC 27005: Managing AI Risks Effectively
ISO/IEC 27001 and ISO/IEC 27005: Managing AI Risks Effectively
PECB 623 views
REPRESENTATION - GAUNTLET.pptx von iammrhaywood
REPRESENTATION - GAUNTLET.pptxREPRESENTATION - GAUNTLET.pptx
REPRESENTATION - GAUNTLET.pptx
iammrhaywood138 views
CUNY IT Picciano.pptx von apicciano
CUNY IT Picciano.pptxCUNY IT Picciano.pptx
CUNY IT Picciano.pptx
apicciano54 views
The Accursed House by Émile Gaboriau von DivyaSheta
The Accursed House  by Émile GaboriauThe Accursed House  by Émile Gaboriau
The Accursed House by Émile Gaboriau
DivyaSheta223 views
Solar System and Galaxies.pptx von DrHafizKosar
Solar System and Galaxies.pptxSolar System and Galaxies.pptx
Solar System and Galaxies.pptx
DrHafizKosar106 views
Ch. 8 Political Party and Party System.pptx von Rommel Regala
Ch. 8 Political Party and Party System.pptxCh. 8 Political Party and Party System.pptx
Ch. 8 Political Party and Party System.pptx
Rommel Regala54 views

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
  • 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