SlideShare uma empresa 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]

Mais conteúdo relacionado

Mais procurados

Chapter 7 relation database language
Chapter 7 relation database languageChapter 7 relation database language
Chapter 7 relation database language
Jafar Nesargi
 
Database normalization
Database normalizationDatabase normalization
Database normalization
Jignesh Jain
 
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
aakanksha s
 
Excel 2003 tutorial 3
Excel 2003 tutorial 3Excel 2003 tutorial 3
Excel 2003 tutorial 3
catacata1976
 
27 f157al5enhanced er diagram
27 f157al5enhanced er diagram27 f157al5enhanced er diagram
27 f157al5enhanced er diagram
dddgh
 
Normalization of database_tables_chapter_4
Normalization of database_tables_chapter_4Normalization of database_tables_chapter_4
Normalization of database_tables_chapter_4
Farhan Chishti
 

Mais procurados (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
 

Destaque

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
MyLocalLoop
 
Loft@holland floor plan
Loft@holland floor planLoft@holland floor plan
Loft@holland floor plan
Anthony Liang
 
Phonics by mummy
Phonics by mummyPhonics by mummy
Phonics by mummy
Sonia Klein
 
Okio residences Showflat brochure
Okio residences Showflat brochureOkio residences Showflat brochure
Okio residences Showflat brochure
Anthony Liang
 
Okio residences floor plan
Okio residences floor planOkio residences floor plan
Okio residences floor plan
Anthony Liang
 

Destaque (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
 

Semelhante a Kul 2

Ch 6 Logical D B Design
Ch 6  Logical D B  DesignCh 6  Logical D B  Design
Ch 6 Logical D B Design
guest8fdbdd
 
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)
welcometofacebook
 
2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS
koolkampus
 
RDBMS ER2 Relational
RDBMS ER2 RelationalRDBMS ER2 Relational
RDBMS ER2 Relational
Sarmad Ali
 

Semelhante 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

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

Último (20)

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
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
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
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
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...
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
 
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
 
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
 

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.