SlideShare una empresa de Scribd logo
1 de 50
Logical Database Design  and the Relational Model
Relation ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Correspondence with ER Model ,[object Object],[object Object],[object Object],[object Object]
Key Fields ,[object Object],[object Object],[object Object],[object Object],[object Object]
Figure 5-3 -- Schema for four relations (Pine Valley Furniture) Primary Key Foreign Key  (implements 1:N relationship between customer and order) Combined, these are a  composite primary key  (uniquely identifies the order line)…individually they are  foreign keys  (implement M:N relationship between order and product)
Integrity Constraints ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Integrity Constraints ,[object Object],[object Object],[object Object],[object Object],[object Object]
Figure 5-5:  Referential integrity constraints (Pine Valley Furniture) Referential integrity constraints are drawn via arrows from dependent to parent table
Transforming EER Diagrams into Relations ,[object Object],[object Object],[object Object],[object Object]
(a) CUSTOMER entity type with simple attributes Figure 5-8: Mapping a regular entity (b) CUSTOMER relation
(a) CUSTOMER entity type with composite attribute Figure 5-9: Mapping a composite attribute (b) CUSTOMER relation with address detail
Figure 5-10: Mapping a multivalued attribute 1 – to – many relationship between original entity and new relation (a) Multivalued attribute becomes a separate relation with foreign key (b)
Transforming EER Diagrams into Relations ,[object Object],[object Object],[object Object],[object Object],[object Object]
Figure 5-11: Example of mapping a weak entity (a) Weak entity DEPENDENT
Figure 5-11(b) Relations resulting from weak entity NOTE: the domain constraint for the foreign key should NOT allow  null  value if DEPENDENT is a weak entity Foreign key Composite primary key
Transforming EER Diagrams into Relations ,[object Object],[object Object],[object Object],[object Object]
Figure 5-12: Example of mapping a 1:M relationship (a) Relationship between customers and orders Note the mandatory one
Figure 5-12(b) Mapping the relationship Again, no null value in the foreign key…this is because of the mandatory minimum cardinality Foreign key
Figure 5-13: Example of mapping an M:N relationship (a) ER diagram (M:N) The  Supplies  relationship will need to become a separate relation
Figure 5-13(b) Three resulting relations New  intersection relation Foreign key Foreign key Composite primary key
Figure 5-14: Mapping a binary 1:1 relationship (a) Binary 1:1 relationship
Figure 5-14(b) Resulting relations
Transforming EER Diagrams into Relations ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Figure 5-15: Mapping an associative entity (a) Associative entity
Figure 5-15(b) Three resulting relations
Transforming EER Diagrams into Relations ,[object Object],[object Object],[object Object],[object Object],[object Object]
Figure 5-17: Mapping a unary 1:N relationship (a) EMPLOYEE entity with Manages relationship (b) EMPLOYEE relation with recursive foreign key
Figure 5-18: Mapping a unary M:N relationship (a) Bill-of-materials relationships (M:N) (b) ITEM and COMPONENT relations
Transforming EER Diagrams into Relations ,[object Object],[object Object],[object Object]
Figure 5-19: Mapping a ternary relationship (a) Ternary relationship with associative entity
Figure 5-19(b) Mapping the ternary relationship Remember that the primary key MUST be unique
Transforming EER Diagrams into Relations ,[object Object],[object Object],[object Object],[object Object],[object Object]
Figure 5-20: Supertype/subtype relationships
Figure 5-21:  Mapping Supertype/subtype relationships to relations
Data Normalization ,[object Object],[object Object]
Well-Structured Relations ,[object Object],[object Object],[object Object],[object Object],[object Object],General rule of thumb: a table should not pertain to more than one entity type
Example – Figure 5.2b Question – Is this a relation?   Answer – Yes: unique rows and no multivalued attributes Question – What’s the primary key?   Answer – Composite: Emp_ID, Course_Title
Anomalies in this Table ,[object Object],[object Object],[object Object],[object Object],[object Object]
Functional Dependencies and Keys ,[object Object],[object Object],[object Object],[object Object],[object Object]
5.22 -Steps in normalization
First Normal Form ,[object Object],[object Object],[object Object],[object Object],[object Object]
Second Normal Form ,[object Object],[object Object],[object Object],[object Object]
Fig 5.23(b) – Functional Dependencies in EMPLOYEE2 Dependency on entire primary key Dependency on only  part  of the key Therefore, NOT in 2 nd  Normal Form!! EmpID CourseTitle DateCompleted Salary DeptName Name EmpID, CourseTitle    DateCompleted EmpID    Name, DeptName, Salary
Getting it into 2 nd  Normal Form ,[object Object],Both are full functional dependencies EmpID Salary DeptName Name CourseTitle DateCompleted EmpID
Third Normal Form ,[object Object],[object Object]
Figure 5-24 -- Relation with transitive dependency (a) SALES relation with simple data
Figure 5-24(b) Relation with transitive dependency CustID    Name CustID    Salesperson CustID    Region All this is OK (2 nd  NF) BUT CustID    Salesperson    Region Transitive dependency (not 3 rd  NF)
Figure 5.25 -- Removing a transitive dependency (a) Decomposing the SALES relation
Figure 5.25(b) Relations in 3NF Now, there are no transitive dependencies… Both relations are in 3 rd  NF CustID    Name CustID    Salesperson Salesperson    Region
Other Normal Forms  (from Appendix B) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]

Más contenido relacionado

La actualidad más candente

Chapter 7 relation database language
Chapter 7 relation database languageChapter 7 relation database language
Chapter 7 relation database languageJafar Nesargi
 
Database normalization
Database normalizationDatabase normalization
Database normalizationJignesh Jain
 
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...Mustafa Kamel Mohammadi
 
Database Modeling Using Entity.. Weak And Strong Entity Types
Database Modeling Using Entity.. Weak And Strong Entity TypesDatabase Modeling Using Entity.. Weak And Strong Entity Types
Database Modeling Using Entity.. Weak And Strong Entity Typesaakanksha s
 
Entity Relationship design issues
Entity Relationship design issuesEntity Relationship design issues
Entity Relationship design issuesMegha Sharma
 
ER Diagrams Simplified
ER Diagrams SimplifiedER Diagrams Simplified
ER Diagrams SimplifiedPuneet Arora
 
Chapter-3 Data Modeling Using the Entity-Relationship Model
Chapter-3  Data Modeling Using the Entity-Relationship ModelChapter-3  Data Modeling Using the Entity-Relationship Model
Chapter-3 Data Modeling Using the Entity-Relationship ModelRaj vardhan
 
Schema relationship to E-R diagram
Schema relationship to E-R diagramSchema relationship to E-R diagram
Schema relationship to E-R diagramBadrul Alam
 
Design dbms
Design dbmsDesign dbms
Design dbmsIIITA
 
Excel 2003 tutorial 3
Excel 2003 tutorial 3Excel 2003 tutorial 3
Excel 2003 tutorial 3catacata1976
 
Bsc cs ii-dbms- u-iii-data modeling using e.r. model (entity relationship model)
Bsc cs ii-dbms- u-iii-data modeling using e.r. model (entity relationship model)Bsc cs ii-dbms- u-iii-data modeling using e.r. model (entity relationship model)
Bsc cs ii-dbms- u-iii-data modeling using e.r. model (entity relationship model)Rai University
 
27 f157al5enhanced er diagram
27 f157al5enhanced er diagram27 f157al5enhanced er diagram
27 f157al5enhanced er diagramdddgh
 
Normalization of database_tables_chapter_4
Normalization of database_tables_chapter_4Normalization of database_tables_chapter_4
Normalization of database_tables_chapter_4Farhan Chishti
 
Normalization
NormalizationNormalization
NormalizationSanSan149
 
Database Management System
Database Management System Database Management System
Database Management System FellowBuddy.com
 

La actualidad más candente (19)

Chapter 7 relation database language
Chapter 7 relation database languageChapter 7 relation database language
Chapter 7 relation database language
 
Database normalization
Database normalizationDatabase normalization
Database normalization
 
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...
 
Database Modeling Using Entity.. Weak And Strong Entity Types
Database Modeling Using Entity.. Weak And Strong Entity TypesDatabase Modeling Using Entity.. Weak And Strong Entity Types
Database Modeling Using Entity.. Weak And Strong Entity Types
 
Entity Relationship design issues
Entity Relationship design issuesEntity Relationship design issues
Entity Relationship design issues
 
ER Diagrams Simplified
ER Diagrams SimplifiedER Diagrams Simplified
ER Diagrams Simplified
 
Chapter-3 Data Modeling Using the Entity-Relationship Model
Chapter-3  Data Modeling Using the Entity-Relationship ModelChapter-3  Data Modeling Using the Entity-Relationship Model
Chapter-3 Data Modeling Using the Entity-Relationship Model
 
Schema relationship to E-R diagram
Schema relationship to E-R diagramSchema relationship to E-R diagram
Schema relationship to E-R diagram
 
Design dbms
Design dbmsDesign dbms
Design dbms
 
Excel 2003 tutorial 3
Excel 2003 tutorial 3Excel 2003 tutorial 3
Excel 2003 tutorial 3
 
Bsc cs ii-dbms- u-iii-data modeling using e.r. model (entity relationship model)
Bsc cs ii-dbms- u-iii-data modeling using e.r. model (entity relationship model)Bsc cs ii-dbms- u-iii-data modeling using e.r. model (entity relationship model)
Bsc cs ii-dbms- u-iii-data modeling using e.r. model (entity relationship model)
 
dbms
dbmsdbms
dbms
 
Normalization.riz
Normalization.rizNormalization.riz
Normalization.riz
 
Keys in Database
Keys in DatabaseKeys in Database
Keys in Database
 
ikd312-03-design
ikd312-03-designikd312-03-design
ikd312-03-design
 
27 f157al5enhanced er diagram
27 f157al5enhanced er diagram27 f157al5enhanced er diagram
27 f157al5enhanced er diagram
 
Normalization of database_tables_chapter_4
Normalization of database_tables_chapter_4Normalization of database_tables_chapter_4
Normalization of database_tables_chapter_4
 
Normalization
NormalizationNormalization
Normalization
 
Database Management System
Database Management System Database Management System
Database Management System
 

Destacado

About My Local Loop: an indepth presentation
About My Local Loop: an indepth presentationAbout My Local Loop: an indepth presentation
About My Local Loop: an indepth presentationMyLocalLoop
 
スーパーウルトララピッドプロトタイピング
スーパーウルトララピッドプロトタイピングスーパーウルトララピッドプロトタイピング
スーパーウルトララピッドプロトタイピングAkifumi Nambu
 
Spottiswoode18 brochure
Spottiswoode18 brochureSpottiswoode18 brochure
Spottiswoode18 brochureAnthony Liang
 
Loft@holland floor plan
Loft@holland floor planLoft@holland floor plan
Loft@holland floor planAnthony Liang
 
Spottiswoode 18 floor plans
Spottiswoode 18 floor plansSpottiswoode 18 floor plans
Spottiswoode 18 floor plansAnthony Liang
 
Phonics by mummy
Phonics by mummyPhonics by mummy
Phonics by mummySonia Klein
 
Okio residences Showflat brochure
Okio residences Showflat brochureOkio residences Showflat brochure
Okio residences Showflat brochureAnthony Liang
 
East coast floor plan +65-92375839 Anthony
East coast floor plan +65-92375839 AnthonyEast coast floor plan +65-92375839 Anthony
East coast floor plan +65-92375839 AnthonyAnthony Liang
 
Okio residences floor plan
Okio residences floor planOkio residences floor plan
Okio residences floor planAnthony Liang
 
Loft@holland brochure
Loft@holland brochureLoft@holland brochure
Loft@holland brochureAnthony Liang
 
9a 4 teste_de_avaliacao_sumativa
9a 4 teste_de_avaliacao_sumativa9a 4 teste_de_avaliacao_sumativa
9a 4 teste_de_avaliacao_sumativaClaudia Moreira
 
I suites@palm Brochure and Floor Plan
I suites@palm Brochure and Floor PlanI suites@palm Brochure and Floor Plan
I suites@palm Brochure and Floor PlanAnthony Liang
 

Destacado (16)

About My Local Loop: an indepth presentation
About My Local Loop: an indepth presentationAbout My Local Loop: an indepth presentation
About My Local Loop: an indepth presentation
 
スーパーウルトララピッドプロトタイピング
スーパーウルトララピッドプロトタイピングスーパーウルトララピッドプロトタイピング
スーパーウルトララピッドプロトタイピング
 
Spottiswoode18 brochure
Spottiswoode18 brochureSpottiswoode18 brochure
Spottiswoode18 brochure
 
Loft@holland floor plan
Loft@holland floor planLoft@holland floor plan
Loft@holland floor plan
 
Spottiswoode 18 floor plans
Spottiswoode 18 floor plansSpottiswoode 18 floor plans
Spottiswoode 18 floor plans
 
Lumiere fact sheet
Lumiere fact sheetLumiere fact sheet
Lumiere fact sheet
 
Arduino001
Arduino001Arduino001
Arduino001
 
Phonics by mummy
Phonics by mummyPhonics by mummy
Phonics by mummy
 
Selva_Resume (3)
Selva_Resume (3)Selva_Resume (3)
Selva_Resume (3)
 
Okio residences Showflat brochure
Okio residences Showflat brochureOkio residences Showflat brochure
Okio residences Showflat brochure
 
East coast floor plan +65-92375839 Anthony
East coast floor plan +65-92375839 AnthonyEast coast floor plan +65-92375839 Anthony
East coast floor plan +65-92375839 Anthony
 
Okio residences floor plan
Okio residences floor planOkio residences floor plan
Okio residences floor plan
 
Loft@holland brochure
Loft@holland brochureLoft@holland brochure
Loft@holland brochure
 
Android night資料
Android night資料Android night資料
Android night資料
 
9a 4 teste_de_avaliacao_sumativa
9a 4 teste_de_avaliacao_sumativa9a 4 teste_de_avaliacao_sumativa
9a 4 teste_de_avaliacao_sumativa
 
I suites@palm Brochure and Floor Plan
I suites@palm Brochure and Floor PlanI suites@palm Brochure and Floor Plan
I suites@palm Brochure and Floor Plan
 

Similar a Kul 2 (20)

Ch 6 Logical D B Design
Ch 6  Logical D B  DesignCh 6  Logical D B  Design
Ch 6 Logical D B Design
 
The Database Environment Chapter 5
The Database Environment Chapter 5The Database Environment Chapter 5
The Database Environment Chapter 5
 
Logical database design and the relational model(database)
Logical database design and the relational model(database)Logical database design and the relational model(database)
Logical database design and the relational model(database)
 
Chap05 c
Chap05 cChap05 c
Chap05 c
 
ER to Relational Mapping
ER to Relational MappingER to Relational Mapping
ER to Relational Mapping
 
dbms er model
dbms er modeldbms er model
dbms er model
 
Unit 2 DBMS
Unit 2 DBMSUnit 2 DBMS
Unit 2 DBMS
 
ER Model and other topics in DBMS
ER Model and other topics in DBMSER Model and other topics in DBMS
ER Model and other topics in DBMS
 
Unit 3 final.pptx
Unit 3 final.pptxUnit 3 final.pptx
Unit 3 final.pptx
 
2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS
 
Test presentation
Test presentationTest presentation
Test presentation
 
L7 er2
L7 er2L7 er2
L7 er2
 
Chapter 2 Relational Data Model-part 3
Chapter 2 Relational Data Model-part 3Chapter 2 Relational Data Model-part 3
Chapter 2 Relational Data Model-part 3
 
ER model
ER modelER model
ER model
 
Er model
Er modelEr model
Er model
 
DBMS - ER Model
DBMS - ER ModelDBMS - ER Model
DBMS - ER Model
 
RDBMS ER2 Relational
RDBMS ER2 RelationalRDBMS ER2 Relational
RDBMS ER2 Relational
 
Data & Databases
Data & Databases Data & Databases
Data & Databases
 
Basic concepts of Data and Databases
Basic concepts of Data and Databases Basic concepts of Data and Databases
Basic concepts of Data and Databases
 
ER_to_tables.ppt
ER_to_tables.pptER_to_tables.ppt
ER_to_tables.ppt
 

Último

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
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
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 GraphThiyagu K
 
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.pdfAdmir Softic
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
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 pdfAyushMahapatra5
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
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
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
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
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 

Último (20)

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
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
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
 
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
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
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
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
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...
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
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
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 

Kul 2

  • 1. Logical Database Design and the Relational Model
  • 2.
  • 3.
  • 4.
  • 5. Figure 5-3 -- Schema for four relations (Pine Valley Furniture) Primary Key Foreign Key (implements 1:N relationship between customer and order) Combined, these are a composite primary key (uniquely identifies the order line)…individually they are foreign keys (implement M:N relationship between order and product)
  • 6.
  • 7.
  • 8. Figure 5-5: Referential integrity constraints (Pine Valley Furniture) Referential integrity constraints are drawn via arrows from dependent to parent table
  • 9.
  • 10. (a) CUSTOMER entity type with simple attributes Figure 5-8: Mapping a regular entity (b) CUSTOMER relation
  • 11. (a) CUSTOMER entity type with composite attribute Figure 5-9: Mapping a composite attribute (b) CUSTOMER relation with address detail
  • 12. Figure 5-10: Mapping a multivalued attribute 1 – to – many relationship between original entity and new relation (a) Multivalued attribute becomes a separate relation with foreign key (b)
  • 13.
  • 14. Figure 5-11: Example of mapping a weak entity (a) Weak entity DEPENDENT
  • 15. Figure 5-11(b) Relations resulting from weak entity NOTE: the domain constraint for the foreign key should NOT allow null value if DEPENDENT is a weak entity Foreign key Composite primary key
  • 16.
  • 17. Figure 5-12: Example of mapping a 1:M relationship (a) Relationship between customers and orders Note the mandatory one
  • 18. Figure 5-12(b) Mapping the relationship Again, no null value in the foreign key…this is because of the mandatory minimum cardinality Foreign key
  • 19. Figure 5-13: Example of mapping an M:N relationship (a) ER diagram (M:N) The Supplies relationship will need to become a separate relation
  • 20. Figure 5-13(b) Three resulting relations New intersection relation Foreign key Foreign key Composite primary key
  • 21. Figure 5-14: Mapping a binary 1:1 relationship (a) Binary 1:1 relationship
  • 23.
  • 24. Figure 5-15: Mapping an associative entity (a) Associative entity
  • 25. Figure 5-15(b) Three resulting relations
  • 26.
  • 27. Figure 5-17: Mapping a unary 1:N relationship (a) EMPLOYEE entity with Manages relationship (b) EMPLOYEE relation with recursive foreign key
  • 28. Figure 5-18: Mapping a unary M:N relationship (a) Bill-of-materials relationships (M:N) (b) ITEM and COMPONENT relations
  • 29.
  • 30. Figure 5-19: Mapping a ternary relationship (a) Ternary relationship with associative entity
  • 31. Figure 5-19(b) Mapping the ternary relationship Remember that the primary key MUST be unique
  • 32.
  • 34. Figure 5-21: Mapping Supertype/subtype relationships to relations
  • 35.
  • 36.
  • 37. Example – Figure 5.2b Question – Is this a relation? Answer – Yes: unique rows and no multivalued attributes Question – What’s the primary key? Answer – Composite: Emp_ID, Course_Title
  • 38.
  • 39.
  • 40. 5.22 -Steps in normalization
  • 41.
  • 42.
  • 43. Fig 5.23(b) – Functional Dependencies in EMPLOYEE2 Dependency on entire primary key Dependency on only part of the key Therefore, NOT in 2 nd Normal Form!! EmpID CourseTitle DateCompleted Salary DeptName Name EmpID, CourseTitle  DateCompleted EmpID  Name, DeptName, Salary
  • 44.
  • 45.
  • 46. Figure 5-24 -- Relation with transitive dependency (a) SALES relation with simple data
  • 47. Figure 5-24(b) Relation with transitive dependency CustID  Name CustID  Salesperson CustID  Region All this is OK (2 nd NF) BUT CustID  Salesperson  Region Transitive dependency (not 3 rd NF)
  • 48. Figure 5.25 -- Removing a transitive dependency (a) Decomposing the SALES relation
  • 49. Figure 5.25(b) Relations in 3NF Now, there are no transitive dependencies… Both relations are in 3 rd NF CustID  Name CustID  Salesperson Salesperson  Region
  • 50.