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

Ähnlich wie 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
 
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
 

Mehr von Samir Sabry

Keyboard symbols
Keyboard symbolsKeyboard symbols
Keyboard symbolsSamir Sabry
 
2010 Calendriersexy
2010 Calendriersexy2010 Calendriersexy
2010 CalendriersexySamir Sabry
 
Sample Test Word Intermediate Mulitple Choice
Sample Test Word Intermediate Mulitple ChoiceSample Test Word Intermediate Mulitple Choice
Sample Test Word Intermediate Mulitple ChoiceSamir Sabry
 
Computer Fundamentals Test
Computer Fundamentals TestComputer Fundamentals Test
Computer Fundamentals TestSamir Sabry
 
Database Management System And Design Questions
Database Management System And Design QuestionsDatabase Management System And Design Questions
Database Management System And Design QuestionsSamir Sabry
 
Digital Image Processing
Digital Image ProcessingDigital Image Processing
Digital Image ProcessingSamir 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

MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docxPoojaSen20
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
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 ...EduSkills OECD
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfUmakantAnnand
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 

Kürzlich hochgeladen (20)

Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docx
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
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 ...
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.Compdf
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 

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