SlideShare ist ein Scribd-Unternehmen logo
1 von 9
Downloaden Sie, um offline zu lesen
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

Weitere ähnliche Inhalte

Ähnlich wie Mapping example

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
 
Please be advised that there are four (4) programs just like this on.docx
Please be advised that there are four (4) programs just like this on.docxPlease be advised that there are four (4) programs just like this on.docx
Please be advised that there are four (4) programs just like this on.docx
lorindajamieson
 
Free video lectures for mca
Free video lectures for mcaFree video lectures for mca
Free video lectures for mca
Edhole.com
 
ECEG 4702-Class7-Entity-Relationship modeling.pptx
ECEG 4702-Class7-Entity-Relationship modeling.pptxECEG 4702-Class7-Entity-Relationship modeling.pptx
ECEG 4702-Class7-Entity-Relationship modeling.pptx
miftah88
 

Ähnlich wie Mapping example (20)

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
 
Chapter3
Chapter3Chapter3
Chapter3
 
Please be advised that there are four (4) programs just like this on.docx
Please be advised that there are four (4) programs just like this on.docxPlease be advised that there are four (4) programs just like this on.docx
Please be advised that there are four (4) programs just like this on.docx
 
Free video lectures for mca
Free video lectures for mcaFree video lectures for mca
Free video lectures for mca
 
ECEG 4702-Class7-Entity-Relationship modeling.pptx
ECEG 4702-Class7-Entity-Relationship modeling.pptxECEG 4702-Class7-Entity-Relationship modeling.pptx
ECEG 4702-Class7-Entity-Relationship modeling.pptx
 
EER modeling
EER modelingEER modeling
EER modeling
 

Mehr von Samir Sabry

Mehr von 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
 

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
 

Kürzlich hochgeladen (20)

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.
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
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
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
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Ữ Â...
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
 
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
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
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
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .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...
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 

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