SlideShare a Scribd company logo
1 of 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]

More Related Content

What's hot

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
 

What's hot (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
 

Viewers also liked

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
 

Viewers also liked (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 to 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
 

Recently uploaded

Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
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
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,Virag Sontakke
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitolTechU
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
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
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
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
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxsocialsciencegdgrohi
 
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
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 

Recently uploaded (20)

Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.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
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptx
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
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
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
 
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
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
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
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 

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.