SlideShare a Scribd company logo
1 of 43
Introduction to Databases
Designing a Database
By Najam-ul-Hassan
Try this book for further Knowledge about
Database Management
Designing Relational Tables
• Typical process for converting E-R
diagrams to relational tables:
– Each entity converts to table
– For many-to-many relationships, each
associative entity converts to table
– Attributes become table columns
– Ensure foreign keys appear in proper places in
tables
• To convert single entity, create table of
same name with column for each attribute
Salesperson Entity and Table
Converting Binary Relationships
• Greater importance in selecting identifier
and primary key
– Identifier and primary key define foreign key
that establishes relationships between tables
• Often more than one way to represent
entity relationships as relational tables
Example: Converting 1-1 Binary Relationship
Example: Converting 1-1 Binary Relationship
Example: Converting 1-1 Binary Relationship
Example: Converting 1-1 Binary Relationship
• Converting one-to-one Salesperson/Office
relationship
– Options:
• Convert relationship to single/combined
table
• Convert relationship to two tables
Example: Converting 1-1 Binary Relationship
• Considerations:
– Business environment considers Salesperson
and Office as separate entities
– Modality of zero at Salesperson entity in E-R
diagram (office may have no one assigned)
– Salesperson entity in E-R diagram has
relationships with other entities
Example: Converting 1-1 Binary Relationship
• Solution 1:
– Combine two entities into one table
Example: Converting 1-1 Binary Relationship
• Solution 2:
– Two separate tables
– Office Number as foreign key in Salesperson
table
Example: Converting 1-1 Binary Relationship
• Solution 3:
– Two separate tables
– Salesperson Number as foreign key in Office
table
Example: Converting 1-M Binary Relationship
Example: Converting 1-M Binary Relationship
• Each occurrence of Salesperson is related
to zero or more occurrences of Customer
• Unique identifier of entity on “one” side is
placed as foreign key in entity of “many”
side
Example: Converting 1-M Binary Relationship
Example: Converting M-M Binary Relationship
Example: Converting M-M Binary Relationship
• Most relational DBMS systems do not
directly support many-to-many
relationships
• Solution: Include associative entity to
establish relationship
• May use composite key as primary key in
associative entity
Example: Converting M-M Binary Relationship
Example: Converting M-M Binary Relationship
Example: Converting 1-1 Unary Relationship
Example: Converting 1-1 Unary Relationship
• With:
– Only one entity type involved, and
– One-to-one relationship
• Conversion requires only one table
Example: Converting 1-M Unary Relationship
Example: Converting 1-M Unary Relationship
Example: Converting M-M Unary Relationship
• Many-to-many unary relationship:
– For example: one product can be constructed
out of set or subset of other products
– General rule in conversion:
• Number of tables equal to number of entity types plus
one more table for many-to-many relationship
– M-M unary relationship - 2 tables
– M-M binary relationship - 3 tables
– M-M ternary relationship - 4 four tables
Example: Converting M-M Unary Relationship
Example: Converting M-M Unary Relationship
Example: Good Reading Bookstores
Example: Good Reading Bookstores
Example: Good Reading Bookstores
Normalizing Data
• Data normalization: Methodology for
organizing attributes into tables to
eliminate redundancy among nonkey
attributes
• Goals:
– Each resultant table describes single entity
type or single many-to-many relationship
– Foreign keys appear exactly where needed
– Properly structured relational database
Normalization Techniques
• Two types of input needed for data
normalization process
1. List of all attributes to be incorporated in database,
including intersection data attributes
2. List of functional dependencies: all defining
associations between attributes
• In functional dependencies, one attribute
(determinate attribute) defines value of
another attribute
Salesperson Number → Salesperson Name
Salesperson Entity Attributes
Salesperson Entity Functional Dependencies
Example: Defining Attributes and Functional Dependencies
• Quantity is defined by two combined
attributes
• Manager is defined independently by two
attributes
– Department Number and Salesperson Number
• Salesperson Number also defines
Department Number
Normalizing Data
• Normal forms: Rules for data normalization
• Three main normal forms
– First normal form
– Second normal form
– Third normal form
• Normalization:
– Uses normal forms to step through “decomposition process”
that decomposes attributes into subgroups
• In third normal form, group of tables is well-
structured relational database with no data
redundancy
Normalizing Data
• First normal form:
– Eliminates multiple values
• Second normal form:
– Eliminates partial functional dependencies (data
dependent on part of primary key)
– Every nonkey attribute must be fully functionally
dependent on entire key of table
• Third normal form:
– Eliminates transitive dependencies (one nonkey
attribute is functionally dependent on another)
– Nonkey attributes are not allowed to define other
nonkey attributes
Example: Unnormalized Data
First Normal Form
Second Normal Form
Third Normal Form
Denormalizing Data
• Denormalizing may be needed when:
– Normalization has been taken to extreme
• Too many small tables creating more work and
storage space
– E.g. Using State table to be referenced instead of
entering two-digit code)
– More efficient data retrieval is needed:
• Many queries requiring resource-intensive joining
• In denormalizing, you join two or more
tables into one less normalized table
Summary
• In converting E-R diagrams to relational tables,
each entity typically converted into table, with
attributes as table columns.
• Considerations in conversion: Business needs,
cardinalities, modalities, and defining foreign keys
to establish relationships.
• Normalization: Uses three main normal forms to
step through “decomposing” attributes into
subgroups that allow data redundancies to be
eliminated.
• Denormalizing may be needed in cases where
storage space and speed of data retrieval are
important factors.
Key Terms
• Composite key
• Data integrity
• Data normalization
• Decomposition
process
• Defining association
• Determinant attribute
• Exception conditions
• First normal form
• Functional
dependency
• Joining
• Non-loss
decomposition
• Normal forms
• Null value
• Partial functional
dependency
• Referential integrity
• Relational integrity
• Second normal form
• Third normal form
(3NF)
• Transitive
dependency

More Related Content

Similar to Database management book slides.ppt

18306_lec-2 (1).ppt
18306_lec-2 (1).ppt18306_lec-2 (1).ppt
18306_lec-2 (1).pptIshuIswarya3
 
overview of database concept
overview of database conceptoverview of database concept
overview of database conceptgourav kottawar
 
Fundamentals of Database ppt ch03
Fundamentals of Database ppt ch03Fundamentals of Database ppt ch03
Fundamentals of Database ppt ch03Jotham Gadot
 
ICT NOTESmbjbujbhbuhuhhipv;ihsjhis 7.pptx
ICT NOTESmbjbujbhbuhuhhipv;ihsjhis 7.pptxICT NOTESmbjbujbhbuhuhhipv;ihsjhis 7.pptx
ICT NOTESmbjbujbhbuhuhhipv;ihsjhis 7.pptxAmanda783100
 
Unit 4 Design_a system analysis and design Designing Database.pdf
Unit 4 Design_a system analysis and design  Designing Database.pdfUnit 4 Design_a system analysis and design  Designing Database.pdf
Unit 4 Design_a system analysis and design Designing Database.pdfSuryaBasnet3
 
Relational database (Unit 2)
Relational database (Unit 2)Relational database (Unit 2)
Relational database (Unit 2)Ismail Mukiibi
 
Relational Database.pptx
Relational Database.pptxRelational Database.pptx
Relational Database.pptxSubhamSarkar64
 
Relational databases.pdf
Relational databases.pdfRelational databases.pdf
Relational databases.pdfchandiruirene
 
Database normalization
Database normalizationDatabase normalization
Database normalizationEdward Blurock
 
Data modeling dimensions for dta warehousing
Data modeling dimensions for dta warehousingData modeling dimensions for dta warehousing
Data modeling dimensions for dta warehousingDr. Dipti Patil
 
Data modeling dimensions
Data modeling dimensionsData modeling dimensions
Data modeling dimensionsDr. Dipti Patil
 
Entity relationship modelling - DE L300
Entity relationship modelling - DE L300Entity relationship modelling - DE L300
Entity relationship modelling - DE L300Edwin Ayernor
 

Similar to Database management book slides.ppt (20)

18306_lec-2 (1).ppt
18306_lec-2 (1).ppt18306_lec-2 (1).ppt
18306_lec-2 (1).ppt
 
DATABASE DESIGN.pptx
DATABASE DESIGN.pptxDATABASE DESIGN.pptx
DATABASE DESIGN.pptx
 
overview of database concept
overview of database conceptoverview of database concept
overview of database concept
 
DATA MODELS.pptx
DATA MODELS.pptxDATA MODELS.pptx
DATA MODELS.pptx
 
demo2.ppt
demo2.pptdemo2.ppt
demo2.ppt
 
Fundamentals of Database ppt ch03
Fundamentals of Database ppt ch03Fundamentals of Database ppt ch03
Fundamentals of Database ppt ch03
 
ICT NOTESmbjbujbhbuhuhhipv;ihsjhis 7.pptx
ICT NOTESmbjbujbhbuhuhhipv;ihsjhis 7.pptxICT NOTESmbjbujbhbuhuhhipv;ihsjhis 7.pptx
ICT NOTESmbjbujbhbuhuhhipv;ihsjhis 7.pptx
 
Chapter 9
Chapter 9Chapter 9
Chapter 9
 
Unit 4 Design_a system analysis and design Designing Database.pdf
Unit 4 Design_a system analysis and design  Designing Database.pdfUnit 4 Design_a system analysis and design  Designing Database.pdf
Unit 4 Design_a system analysis and design Designing Database.pdf
 
Relational database (Unit 2)
Relational database (Unit 2)Relational database (Unit 2)
Relational database (Unit 2)
 
ERD.ppt
ERD.pptERD.ppt
ERD.ppt
 
ERD.ppt
ERD.pptERD.ppt
ERD.ppt
 
Relational Data Model.pptx
Relational Data Model.pptxRelational Data Model.pptx
Relational Data Model.pptx
 
Relational Database.pptx
Relational Database.pptxRelational Database.pptx
Relational Database.pptx
 
Relational databases.pdf
Relational databases.pdfRelational databases.pdf
Relational databases.pdf
 
Database normalization
Database normalizationDatabase normalization
Database normalization
 
Introduction to Databases
Introduction to DatabasesIntroduction to Databases
Introduction to Databases
 
Data modeling dimensions for dta warehousing
Data modeling dimensions for dta warehousingData modeling dimensions for dta warehousing
Data modeling dimensions for dta warehousing
 
Data modeling dimensions
Data modeling dimensionsData modeling dimensions
Data modeling dimensions
 
Entity relationship modelling - DE L300
Entity relationship modelling - DE L300Entity relationship modelling - DE L300
Entity relationship modelling - DE L300
 

More from AssadLeo1

half day batch male hafizabad list of pos and apos
half day batch male hafizabad list of pos and aposhalf day batch male hafizabad list of pos and apos
half day batch male hafizabad list of pos and aposAssadLeo1
 
MS Excel Detailed into.pptx
MS Excel Detailed into.pptxMS Excel Detailed into.pptx
MS Excel Detailed into.pptxAssadLeo1
 
INput output stream in ccP Full Detail.pptx
INput output stream in ccP Full Detail.pptxINput output stream in ccP Full Detail.pptx
INput output stream in ccP Full Detail.pptxAssadLeo1
 
Polymorphism OOP Old Gate.pptx
Polymorphism OOP Old Gate.pptxPolymorphism OOP Old Gate.pptx
Polymorphism OOP Old Gate.pptxAssadLeo1
 
MS Excel Detailed intorduction.pptx
MS Excel Detailed intorduction.pptxMS Excel Detailed intorduction.pptx
MS Excel Detailed intorduction.pptxAssadLeo1
 
network-management Web base.ppt
network-management Web base.pptnetwork-management Web base.ppt
network-management Web base.pptAssadLeo1
 
Polymorphism OOP new Gate.pptx
Polymorphism OOP new Gate.pptxPolymorphism OOP new Gate.pptx
Polymorphism OOP new Gate.pptxAssadLeo1
 
polymorphism OOP.pptx
polymorphism OOP.pptxpolymorphism OOP.pptx
polymorphism OOP.pptxAssadLeo1
 
MS Excel Lite Introduction.ppt
MS Excel Lite Introduction.pptMS Excel Lite Introduction.ppt
MS Excel Lite Introduction.pptAssadLeo1
 
Monitoring sytem.ppt
Monitoring sytem.pptMonitoring sytem.ppt
Monitoring sytem.pptAssadLeo1
 

More from AssadLeo1 (10)

half day batch male hafizabad list of pos and apos
half day batch male hafizabad list of pos and aposhalf day batch male hafizabad list of pos and apos
half day batch male hafizabad list of pos and apos
 
MS Excel Detailed into.pptx
MS Excel Detailed into.pptxMS Excel Detailed into.pptx
MS Excel Detailed into.pptx
 
INput output stream in ccP Full Detail.pptx
INput output stream in ccP Full Detail.pptxINput output stream in ccP Full Detail.pptx
INput output stream in ccP Full Detail.pptx
 
Polymorphism OOP Old Gate.pptx
Polymorphism OOP Old Gate.pptxPolymorphism OOP Old Gate.pptx
Polymorphism OOP Old Gate.pptx
 
MS Excel Detailed intorduction.pptx
MS Excel Detailed intorduction.pptxMS Excel Detailed intorduction.pptx
MS Excel Detailed intorduction.pptx
 
network-management Web base.ppt
network-management Web base.pptnetwork-management Web base.ppt
network-management Web base.ppt
 
Polymorphism OOP new Gate.pptx
Polymorphism OOP new Gate.pptxPolymorphism OOP new Gate.pptx
Polymorphism OOP new Gate.pptx
 
polymorphism OOP.pptx
polymorphism OOP.pptxpolymorphism OOP.pptx
polymorphism OOP.pptx
 
MS Excel Lite Introduction.ppt
MS Excel Lite Introduction.pptMS Excel Lite Introduction.ppt
MS Excel Lite Introduction.ppt
 
Monitoring sytem.ppt
Monitoring sytem.pptMonitoring sytem.ppt
Monitoring sytem.ppt
 

Recently uploaded

DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
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
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupJonathanParaisoCruz
 
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
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentInMediaRes1
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,Virag Sontakke
 
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
 
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
 
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
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
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
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
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
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Recently uploaded (20)

DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
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
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized Group
 
ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)
 
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
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media Component
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
 
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
 
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
 
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
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
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
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
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
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
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
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 

Database management book slides.ppt

  • 1. Introduction to Databases Designing a Database By Najam-ul-Hassan Try this book for further Knowledge about Database Management
  • 2. Designing Relational Tables • Typical process for converting E-R diagrams to relational tables: – Each entity converts to table – For many-to-many relationships, each associative entity converts to table – Attributes become table columns – Ensure foreign keys appear in proper places in tables • To convert single entity, create table of same name with column for each attribute
  • 4. Converting Binary Relationships • Greater importance in selecting identifier and primary key – Identifier and primary key define foreign key that establishes relationships between tables • Often more than one way to represent entity relationships as relational tables
  • 5. Example: Converting 1-1 Binary Relationship
  • 6. Example: Converting 1-1 Binary Relationship
  • 7. Example: Converting 1-1 Binary Relationship
  • 8. Example: Converting 1-1 Binary Relationship • Converting one-to-one Salesperson/Office relationship – Options: • Convert relationship to single/combined table • Convert relationship to two tables
  • 9. Example: Converting 1-1 Binary Relationship • Considerations: – Business environment considers Salesperson and Office as separate entities – Modality of zero at Salesperson entity in E-R diagram (office may have no one assigned) – Salesperson entity in E-R diagram has relationships with other entities
  • 10. Example: Converting 1-1 Binary Relationship • Solution 1: – Combine two entities into one table
  • 11. Example: Converting 1-1 Binary Relationship • Solution 2: – Two separate tables – Office Number as foreign key in Salesperson table
  • 12. Example: Converting 1-1 Binary Relationship • Solution 3: – Two separate tables – Salesperson Number as foreign key in Office table
  • 13. Example: Converting 1-M Binary Relationship
  • 14. Example: Converting 1-M Binary Relationship • Each occurrence of Salesperson is related to zero or more occurrences of Customer • Unique identifier of entity on “one” side is placed as foreign key in entity of “many” side
  • 15. Example: Converting 1-M Binary Relationship
  • 16. Example: Converting M-M Binary Relationship
  • 17. Example: Converting M-M Binary Relationship • Most relational DBMS systems do not directly support many-to-many relationships • Solution: Include associative entity to establish relationship • May use composite key as primary key in associative entity
  • 18. Example: Converting M-M Binary Relationship
  • 19. Example: Converting M-M Binary Relationship
  • 20. Example: Converting 1-1 Unary Relationship
  • 21. Example: Converting 1-1 Unary Relationship • With: – Only one entity type involved, and – One-to-one relationship • Conversion requires only one table
  • 22. Example: Converting 1-M Unary Relationship
  • 23. Example: Converting 1-M Unary Relationship
  • 24. Example: Converting M-M Unary Relationship • Many-to-many unary relationship: – For example: one product can be constructed out of set or subset of other products – General rule in conversion: • Number of tables equal to number of entity types plus one more table for many-to-many relationship – M-M unary relationship - 2 tables – M-M binary relationship - 3 tables – M-M ternary relationship - 4 four tables
  • 25. Example: Converting M-M Unary Relationship
  • 26. Example: Converting M-M Unary Relationship
  • 27. Example: Good Reading Bookstores
  • 28. Example: Good Reading Bookstores
  • 29. Example: Good Reading Bookstores
  • 30. Normalizing Data • Data normalization: Methodology for organizing attributes into tables to eliminate redundancy among nonkey attributes • Goals: – Each resultant table describes single entity type or single many-to-many relationship – Foreign keys appear exactly where needed – Properly structured relational database
  • 31. Normalization Techniques • Two types of input needed for data normalization process 1. List of all attributes to be incorporated in database, including intersection data attributes 2. List of functional dependencies: all defining associations between attributes • In functional dependencies, one attribute (determinate attribute) defines value of another attribute Salesperson Number → Salesperson Name
  • 34. Example: Defining Attributes and Functional Dependencies • Quantity is defined by two combined attributes • Manager is defined independently by two attributes – Department Number and Salesperson Number • Salesperson Number also defines Department Number
  • 35. Normalizing Data • Normal forms: Rules for data normalization • Three main normal forms – First normal form – Second normal form – Third normal form • Normalization: – Uses normal forms to step through “decomposition process” that decomposes attributes into subgroups • In third normal form, group of tables is well- structured relational database with no data redundancy
  • 36. Normalizing Data • First normal form: – Eliminates multiple values • Second normal form: – Eliminates partial functional dependencies (data dependent on part of primary key) – Every nonkey attribute must be fully functionally dependent on entire key of table • Third normal form: – Eliminates transitive dependencies (one nonkey attribute is functionally dependent on another) – Nonkey attributes are not allowed to define other nonkey attributes
  • 41. Denormalizing Data • Denormalizing may be needed when: – Normalization has been taken to extreme • Too many small tables creating more work and storage space – E.g. Using State table to be referenced instead of entering two-digit code) – More efficient data retrieval is needed: • Many queries requiring resource-intensive joining • In denormalizing, you join two or more tables into one less normalized table
  • 42. Summary • In converting E-R diagrams to relational tables, each entity typically converted into table, with attributes as table columns. • Considerations in conversion: Business needs, cardinalities, modalities, and defining foreign keys to establish relationships. • Normalization: Uses three main normal forms to step through “decomposing” attributes into subgroups that allow data redundancies to be eliminated. • Denormalizing may be needed in cases where storage space and speed of data retrieval are important factors.
  • 43. Key Terms • Composite key • Data integrity • Data normalization • Decomposition process • Defining association • Determinant attribute • Exception conditions • First normal form • Functional dependency • Joining • Non-loss decomposition • Normal forms • Null value • Partial functional dependency • Referential integrity • Relational integrity • Second normal form • Third normal form (3NF) • Transitive dependency