SlideShare une entreprise Scribd logo
1  sur  11
Télécharger pour lire hors ligne
www.lib.ku.edu/instruction




                                     Database Design
                                  Practical Database Design for
                                            Relational Database
                                         Management Systems




                      Overview
                           A little background and terminology:
                                What is a relational database?
                                What is a primary key?
                                What is a foreign key?
                           Things to know about designing a database:
                                The normalization process and how/why use it
                                Relating tables
                                Types of relationships

                      9/19/07                                                  2




© 2007 Instructional Services at KU Libraries, The University of Kansas
www.lib.ku.edu/instruction




                      Relational Database Management
                      System

                           Collection of information organized in tables
                                Tables are also “relations”
                           Tables are constructed and associated to each other
                           through shared fields–“common” fields
                                Fields are also “columns” or “attributes”
                           A set of attributes comprises a record
                                Records are also “rows” or “tuples”
                           Tables are related through common fields
                           designated as primary and foreign keys
                           Allow us to find, update, and delete data quickly,
                           and help to ensure accuracy
                      9/19/07                                                     3




                      Primary and Foreign Key
                      Fields
                           Primary Key
                                Primary key fields must be unique and cannot
                                contain a null value.
                                Each table should have a primary key field.
                                Concatenated keys: using more than one field as
                                a primary key field.
                           Foreign Key: Fields in a table that refer to
                           the primary key in another table
                                The data in this field must exactly match data
                                contained in the primary key field.
                      9/19/07                                                     4




© 2007 Instructional Services at KU Libraries, The University of Kansas
www.lib.ku.edu/instruction




                      What is Normalization?
                           The process by which we efficiently organize data to achieve
                           these goals:
                                Eliminating redundancy
                                Ensuring data is stored in the correct table
                                Eliminating need for restructuring database when data is added.
                           Five levels of normal form
                                In order to achieve one level of normal form, each previous level
                                must be met


                                        Third normal form is sufficient for
                                        most typical database applications.

                      9/19/07                                                                       5




                      First Normal Form (1NF)
                           There are no repeating or duplicate fields.
                           Each cell contains only a single value.
                           Each record is unique.
                                Identified by primary key




                      9/19/07                                                                       6




© 2007 Instructional Services at KU Libraries, The University of Kansas
www.lib.ku.edu/instruction




                      Example
                      item                 colors          price     tax
                      T-shirt              red, blue       12.00     0.60
                      polo                 red, yellow     12.00     0.60
                      T-shirt              red, blue       12.00     0.60
                      sweatshirt           blue, black     25.00     1.25

                      Table is not in first normal form because:
                                Multiple items in color field
                                Duplicate records / no primary key

                      9/19/07                                               7




                      Example
                      item                 color           price     tax
                      T-shirt              red             12.00     0.60
                      T-shirt              blue            12.00     0.60
                      polo                 red             12.00     0.60
                      polo                 yellow          12.00     0.60
                      sweatshirt           blue            25.00     1.25
                      sweatshirt           black           25.00     1.25

                      Table is now in first normal form.

                      9/19/07                                               8




© 2007 Instructional Services at KU Libraries, The University of Kansas
www.lib.ku.edu/instruction




                      Second Normal Form (2NF)
                           All non-key fields depend on all components
                           of the primary key.
                                Guaranteed when primary key is a single field.




                      9/19/07                                                    9




                      Example
                      item               color          price         tax
                      T-shirt            red            12.00         0.60
                      T-shirt            blue           12.00         0.60
                      polo               red            12.00         0.60
                      polo               yellow         12.00         0.60
                      sweatshirt         blue           25.00         1.25
                      sweatshirt         black          25.00         1.25
                      Table is not in second normal form because:
                                price and tax depend on item, but not color
                      9/19/07                                                    10




© 2007 Instructional Services at KU Libraries, The University of Kansas
www.lib.ku.edu/instruction




                      Example
                      item             color         item         price   tax
                      T-shirt          red           T-shirt      12.00   0.60
                      T-shirt          blue          polo         12.00   0.60
                      polo             red           sweatshirt   25.00   1.25
                      polo             yellow
                      sweatshirt       blue
                      sweatshirt       black

                      Tables are now in second normal form.

                      9/19/07                                                    11




                      Third Normal Form (3NF)
                           No non-key field depends upon another.
                                All non-key fields depend only on the primary key.




                      9/19/07                                                    12




© 2007 Instructional Services at KU Libraries, The University of Kansas
www.lib.ku.edu/instruction




                      Example
                      item               color        item              price            tax
                      T-shirt            red          T-shirt           12.00            0.60
                      T-shirt            blue         polo              12.00            0.60
                      polo               red          sweatshirt        25.00            1.25
                      polo               yellow
                      sweatshirt         blue
                      sweatshirt         black

                      Tables are not in third normal form because:
                                tax depends on price, not item
                      9/19/07                                                                   13




                      Example
                            item            color            item                price
                            T-shirt         red              T-shirt             12.00
                            T-shirt         blue             polo                12.00
                            polo            red              sweatshirt          25.00
                            polo            yellow
                            sweatshirt      blue                price     tax
                            sweatshirt      black               12.00     0.60
                                                                25.00     1.25

                      Tables are now in third normal form.
                      9/19/07                                                                   14




© 2007 Instructional Services at KU Libraries, The University of Kansas
www.lib.ku.edu/instruction




                      Another Example
                           Name                              Assignment 1           Assignment 2
                           Jeff Smith                        Article Summary        Poetry Analysis

                           Nancy Jones                       Article Summary        Reaction Paper

                           Jane Scott                        Article Summary        Poetry Analysis


                           Table is not in first normal form because:
                                    Assignment field repeating
                                    First and last name in one field
                                    No (guaranteed unique) primary key field
                      9/19/07                                                                                   15




                      Another Example
                       Assignment ID           Description
                       1                       Article Summary                 Assignment ID       Student ID
                       2                       Poetry Analysis                 1                   1
                       3                       Reaction Paper                  1                   2
                                                                               1                   3
                                                                               2                   1
                       Student ID       First Name      Last Name
                                                                               2                   3
                       1                Jeff            Smith
                                                                               3                   2
                       2                Nancy           Jones
                       3                Jane            Scott

                     Tables are in third normal form.
                      9/19/07                                                                                   16




© 2007 Instructional Services at KU Libraries, The University of Kansas
www.lib.ku.edu/instruction




                      Relationships
                           Relationships are created between tables using the
                           primary key field and a foreign key field
                                One to One Relationship
                                 One record in a table relates to one record in another table
                                One to Many Relationship
                                 One record in a table can relate to many records in another
                                 table
                                Many to Many Relationship
                                 Many records in one table can relate to many records in
                                 another table


                      9/19/07                                                                  17




                      Relationships in First Example
                      item              color                      item                price
                      T-shirt           red                        T-shirt             12.00
                      T-shirt           blue                       polo                12.00
                      polo              red                        sweatshirt          25.00
                      polo              yellow
                      sweatshirt        blue
                      sweatshirt        black
                                                                    price       tax
                                      one to one                    12.00       0.60
                                      one to many                   25.00       1.25
                      9/19/07                                                                  18




© 2007 Instructional Services at KU Libraries, The University of Kansas
www.lib.ku.edu/instruction




                         Relationships in Second Example
                     Assignment ID          Description
                     1                      Article Summary      Assignment ID     Student ID

                     2                      Poetry Analysis      1                 1

                     3                      Reaction Paper       1                 2
                                                                 1                 3
                                                                 2                 1
                                                                 2                 3
                     Student ID      First Name      Last Name   3                 2
                     1               Jeff            Smith
                                                                                 one to one
                     2               Nancy           Jones
                                                                                 one to many
                     3               Jane            Scott                       many to many
                         9/19/07                                                                19




                         Bibliography
                              Hernandez, Michael J. Database Design for Mere Mortals.
                              San Francisco: Addison-Wesley, 1997.
                              Chapple, Mike. “ Database Normalization Basics.” 5 August
                              2001. Online. Internet. Available
                              http://databases.about.com/library/weekly/aa080501a.htm
                              Association for Geographic Information. GIS Dictionary. 1999.
                              Online. Internet.
                              Available http://www.geo.ed.ac.uk/agidexe/term?821
                              Wise, Barry. “Database Normalization and Design
                              Techniques.” 1 August 2000. 6 pp. Online. Internet. Available
                              http://www.phpbuilder.com/columns/barry20000731.php3

                         9/19/07                                                                20




© 2007 Instructional Services at KU Libraries, The University of Kansas
www.lib.ku.edu/instruction




                      Further Reading
                           Harrington, Jan L. Relational Database Design Clearly
                           Explained. San Diego: Academic Express, 1998.
                           Chapple, Mike. “Choosing a Database Product.” 6 May 2001.
                           Online. Internet. Available
                           http://databases.about.com/library/weekly/aa050601a.htm
                           Gilmore, W.J. “Introduction to Database Normalization.” 27
                           November 2000. Online. Internet. Available
                           http://www.devshed.com/Server_Side/MySQL/Normal/Normal
                           1/page1.html




                      9/19/07                                                       21




© 2007 Instructional Services at KU Libraries, The University of Kansas

Contenu connexe

Tendances

Database Normalization
Database NormalizationDatabase Normalization
Database NormalizationArun Sharma
 
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NFDatabase Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NFOum Saokosal
 
Dbms 14: Relational Calculus
Dbms 14: Relational CalculusDbms 14: Relational Calculus
Dbms 14: Relational CalculusAmiya9439793168
 
Integrity Constraints
Integrity ConstraintsIntegrity Constraints
Integrity Constraintsmadhav bansal
 
Database Concept - Normalization (1NF, 2NF, 3NF)
Database Concept - Normalization (1NF, 2NF, 3NF)Database Concept - Normalization (1NF, 2NF, 3NF)
Database Concept - Normalization (1NF, 2NF, 3NF)Oum Saokosal
 
Learn Normalization in simple language
Learn Normalization in simple languageLearn Normalization in simple language
Learn Normalization in simple languageFirstWire Apps
 
PL/SQL Introduction and Concepts
PL/SQL Introduction and Concepts PL/SQL Introduction and Concepts
PL/SQL Introduction and Concepts Bharat Kalia
 
14. Query Optimization in DBMS
14. Query Optimization in DBMS14. Query Optimization in DBMS
14. Query Optimization in DBMSkoolkampus
 
Entity Relationship Diagram
Entity Relationship DiagramEntity Relationship Diagram
Entity Relationship DiagramShakila Mahjabin
 
Database Relationships
Database RelationshipsDatabase Relationships
Database Relationshipswmassie
 
Constraints In Sql
Constraints In SqlConstraints In Sql
Constraints In SqlAnurag
 

Tendances (20)

Relational model
Relational modelRelational model
Relational model
 
DML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with Examples
DML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with ExamplesDML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with Examples
DML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with Examples
 
Database Normalization
Database NormalizationDatabase Normalization
Database Normalization
 
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NFDatabase Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
 
Unit 03 dbms
Unit 03 dbmsUnit 03 dbms
Unit 03 dbms
 
Normalization
NormalizationNormalization
Normalization
 
Dbms 14: Relational Calculus
Dbms 14: Relational CalculusDbms 14: Relational Calculus
Dbms 14: Relational Calculus
 
Integrity Constraints
Integrity ConstraintsIntegrity Constraints
Integrity Constraints
 
Normalization in DBMS
Normalization in DBMSNormalization in DBMS
Normalization in DBMS
 
Database Concept - Normalization (1NF, 2NF, 3NF)
Database Concept - Normalization (1NF, 2NF, 3NF)Database Concept - Normalization (1NF, 2NF, 3NF)
Database Concept - Normalization (1NF, 2NF, 3NF)
 
Learn Normalization in simple language
Learn Normalization in simple languageLearn Normalization in simple language
Learn Normalization in simple language
 
Relational algebra in dbms
Relational algebra in dbmsRelational algebra in dbms
Relational algebra in dbms
 
joins in database
 joins in database joins in database
joins in database
 
PL/SQL Introduction and Concepts
PL/SQL Introduction and Concepts PL/SQL Introduction and Concepts
PL/SQL Introduction and Concepts
 
14. Query Optimization in DBMS
14. Query Optimization in DBMS14. Query Optimization in DBMS
14. Query Optimization in DBMS
 
Entity Relationship Diagram
Entity Relationship DiagramEntity Relationship Diagram
Entity Relationship Diagram
 
Database Relationships
Database RelationshipsDatabase Relationships
Database Relationships
 
Sql ppt
Sql pptSql ppt
Sql ppt
 
Constraints In Sql
Constraints In SqlConstraints In Sql
Constraints In Sql
 
SQL commands
SQL commandsSQL commands
SQL commands
 

En vedette

Normalization
NormalizationNormalization
Normalizationochesing
 
ERD Case scenario
ERD Case scenarioERD Case scenario
ERD Case scenariomarkthesuth
 
Database Normalization
Database NormalizationDatabase Normalization
Database NormalizationRathan Raj
 
Entity relationship diagram - Concept on normalization
Entity relationship diagram - Concept on normalizationEntity relationship diagram - Concept on normalization
Entity relationship diagram - Concept on normalizationSatya Pal
 
ER DIAGRAM TO RELATIONAL SCHEMA MAPPING
ER DIAGRAM TO RELATIONAL SCHEMA MAPPING ER DIAGRAM TO RELATIONAL SCHEMA MAPPING
ER DIAGRAM TO RELATIONAL SCHEMA MAPPING ARADHYAYANA
 
Indexing and hashing
Indexing and hashingIndexing and hashing
Indexing and hashingJeet Poria
 
Relational Algebra-Database Systems
Relational Algebra-Database SystemsRelational Algebra-Database Systems
Relational Algebra-Database Systemsjakodongo
 
Architecture of-dbms-and-data-independence
Architecture of-dbms-and-data-independenceArchitecture of-dbms-and-data-independence
Architecture of-dbms-and-data-independenceAnuj Modi
 
Relational algebra in dbms
Relational algebra in dbmsRelational algebra in dbms
Relational algebra in dbmsshekhar1991
 
A database design_report_for_college_library final
A database design_report_for_college_library finalA database design_report_for_college_library final
A database design_report_for_college_library finalSaira Iqbal
 
12. Indexing and Hashing in DBMS
12. Indexing and Hashing in DBMS12. Indexing and Hashing in DBMS
12. Indexing and Hashing in DBMSkoolkampus
 
ERP Implementation Life Cycle
ERP Implementation Life CycleERP Implementation Life Cycle
ERP Implementation Life CycleApurv Gourav
 
Business process reengineering
Business process reengineeringBusiness process reengineering
Business process reengineeringNeelkamal Sharma
 

En vedette (20)

DBMS - Normalization
DBMS - NormalizationDBMS - Normalization
DBMS - Normalization
 
Normalization
NormalizationNormalization
Normalization
 
Crj 3 1-b
Crj 3 1-bCrj 3 1-b
Crj 3 1-b
 
ERD Case scenario
ERD Case scenarioERD Case scenario
ERD Case scenario
 
Database Normalization
Database NormalizationDatabase Normalization
Database Normalization
 
Entity relationship diagram - Concept on normalization
Entity relationship diagram - Concept on normalizationEntity relationship diagram - Concept on normalization
Entity relationship diagram - Concept on normalization
 
ER DIAGRAM TO RELATIONAL SCHEMA MAPPING
ER DIAGRAM TO RELATIONAL SCHEMA MAPPING ER DIAGRAM TO RELATIONAL SCHEMA MAPPING
ER DIAGRAM TO RELATIONAL SCHEMA MAPPING
 
Dbms architecture
Dbms architectureDbms architecture
Dbms architecture
 
Indexing and hashing
Indexing and hashingIndexing and hashing
Indexing and hashing
 
Database management system basic, database, database management, learn databa...
Database management system basic, database, database management, learn databa...Database management system basic, database, database management, learn databa...
Database management system basic, database, database management, learn databa...
 
Relational Algebra-Database Systems
Relational Algebra-Database SystemsRelational Algebra-Database Systems
Relational Algebra-Database Systems
 
Architecture of-dbms-and-data-independence
Architecture of-dbms-and-data-independenceArchitecture of-dbms-and-data-independence
Architecture of-dbms-and-data-independence
 
Relational algebra in dbms
Relational algebra in dbmsRelational algebra in dbms
Relational algebra in dbms
 
A database design_report_for_college_library final
A database design_report_for_college_library finalA database design_report_for_college_library final
A database design_report_for_college_library final
 
PLM Introduction
PLM IntroductionPLM Introduction
PLM Introduction
 
Database language
Database languageDatabase language
Database language
 
Trigger
TriggerTrigger
Trigger
 
12. Indexing and Hashing in DBMS
12. Indexing and Hashing in DBMS12. Indexing and Hashing in DBMS
12. Indexing and Hashing in DBMS
 
ERP Implementation Life Cycle
ERP Implementation Life CycleERP Implementation Life Cycle
ERP Implementation Life Cycle
 
Business process reengineering
Business process reengineeringBusiness process reengineering
Business process reengineering
 

Plus de Jargalsaikhan Alyeksandr (20)

Microsoft IT Academy
Microsoft IT AcademyMicrosoft IT Academy
Microsoft IT Academy
 
Computer ethics and system security
Computer ethics and system securityComputer ethics and system security
Computer ethics and system security
 
Cs203 lecture 14 reflection
Cs203 lecture 14  reflectionCs203 lecture 14  reflection
Cs203 lecture 14 reflection
 
Cs203 lecture13 composition
Cs203 lecture13 compositionCs203 lecture13 composition
Cs203 lecture13 composition
 
Cs203 lab8
Cs203 lab8Cs203 lab8
Cs203 lab8
 
Sw203 Lecture12 Composition
Sw203 Lecture12 CompositionSw203 Lecture12 Composition
Sw203 Lecture12 Composition
 
SW203 Lab9
SW203  Lab9SW203  Lab9
SW203 Lab9
 
SW203 Lab10
SW203  Lab10SW203  Lab10
SW203 Lab10
 
Sw203 Lecture10 Polymorphism
Sw203 Lecture10 PolymorphismSw203 Lecture10 Polymorphism
Sw203 Lecture10 Polymorphism
 
Sw203 Lecture9 Encapsulation
Sw203 Lecture9  EncapsulationSw203 Lecture9  Encapsulation
Sw203 Lecture9 Encapsulation
 
Sw203 Lecture5 Class Acess Modifiers
Sw203 Lecture5 Class Acess ModifiersSw203 Lecture5 Class Acess Modifiers
Sw203 Lecture5 Class Acess Modifiers
 
Sw203lab8
Sw203lab8Sw203lab8
Sw203lab8
 
S W203 Lecture8 Interface
S W203  Lecture8  InterfaceS W203  Lecture8  Interface
S W203 Lecture8 Interface
 
Sw203 Lecture8 Interface
Sw203 Lecture8 InterfaceSw203 Lecture8 Interface
Sw203 Lecture8 Interface
 
Sw203 Lab7
Sw203 Lab7Sw203 Lab7
Sw203 Lab7
 
Sw203lab6
Sw203lab6Sw203lab6
Sw203lab6
 
Sw203lab5
Sw203lab5Sw203lab5
Sw203lab5
 
Sw203 Lecture11 Casting
Sw203 Lecture11 CastingSw203 Lecture11 Casting
Sw203 Lecture11 Casting
 
Sw203 Lecture7 Method Override
Sw203 Lecture7  Method OverrideSw203 Lecture7  Method Override
Sw203 Lecture7 Method Override
 
Sw203 Lecture6 Inheritance
Sw203 Lecture6 InheritanceSw203 Lecture6 Inheritance
Sw203 Lecture6 Inheritance
 

Dernier

THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4MiaBumagat1
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxCarlos105
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)cama23
 
Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationActivity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationRosabel UA
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptxiammrhaywood
 
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptxMusic 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptxleah joy valeriano
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSJoshuaGantuangco2
 
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...JojoEDelaCruz
 

Dernier (20)

THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)
 
Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationActivity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translation
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
 
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptxMusic 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
 
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
 

Database design & Normalization (1NF, 2NF, 3NF)

  • 1. www.lib.ku.edu/instruction Database Design Practical Database Design for Relational Database Management Systems Overview A little background and terminology: What is a relational database? What is a primary key? What is a foreign key? Things to know about designing a database: The normalization process and how/why use it Relating tables Types of relationships 9/19/07 2 © 2007 Instructional Services at KU Libraries, The University of Kansas
  • 2. www.lib.ku.edu/instruction Relational Database Management System Collection of information organized in tables Tables are also “relations” Tables are constructed and associated to each other through shared fields–“common” fields Fields are also “columns” or “attributes” A set of attributes comprises a record Records are also “rows” or “tuples” Tables are related through common fields designated as primary and foreign keys Allow us to find, update, and delete data quickly, and help to ensure accuracy 9/19/07 3 Primary and Foreign Key Fields Primary Key Primary key fields must be unique and cannot contain a null value. Each table should have a primary key field. Concatenated keys: using more than one field as a primary key field. Foreign Key: Fields in a table that refer to the primary key in another table The data in this field must exactly match data contained in the primary key field. 9/19/07 4 © 2007 Instructional Services at KU Libraries, The University of Kansas
  • 3. www.lib.ku.edu/instruction What is Normalization? The process by which we efficiently organize data to achieve these goals: Eliminating redundancy Ensuring data is stored in the correct table Eliminating need for restructuring database when data is added. Five levels of normal form In order to achieve one level of normal form, each previous level must be met Third normal form is sufficient for most typical database applications. 9/19/07 5 First Normal Form (1NF) There are no repeating or duplicate fields. Each cell contains only a single value. Each record is unique. Identified by primary key 9/19/07 6 © 2007 Instructional Services at KU Libraries, The University of Kansas
  • 4. www.lib.ku.edu/instruction Example item colors price tax T-shirt red, blue 12.00 0.60 polo red, yellow 12.00 0.60 T-shirt red, blue 12.00 0.60 sweatshirt blue, black 25.00 1.25 Table is not in first normal form because: Multiple items in color field Duplicate records / no primary key 9/19/07 7 Example item color price tax T-shirt red 12.00 0.60 T-shirt blue 12.00 0.60 polo red 12.00 0.60 polo yellow 12.00 0.60 sweatshirt blue 25.00 1.25 sweatshirt black 25.00 1.25 Table is now in first normal form. 9/19/07 8 © 2007 Instructional Services at KU Libraries, The University of Kansas
  • 5. www.lib.ku.edu/instruction Second Normal Form (2NF) All non-key fields depend on all components of the primary key. Guaranteed when primary key is a single field. 9/19/07 9 Example item color price tax T-shirt red 12.00 0.60 T-shirt blue 12.00 0.60 polo red 12.00 0.60 polo yellow 12.00 0.60 sweatshirt blue 25.00 1.25 sweatshirt black 25.00 1.25 Table is not in second normal form because: price and tax depend on item, but not color 9/19/07 10 © 2007 Instructional Services at KU Libraries, The University of Kansas
  • 6. www.lib.ku.edu/instruction Example item color item price tax T-shirt red T-shirt 12.00 0.60 T-shirt blue polo 12.00 0.60 polo red sweatshirt 25.00 1.25 polo yellow sweatshirt blue sweatshirt black Tables are now in second normal form. 9/19/07 11 Third Normal Form (3NF) No non-key field depends upon another. All non-key fields depend only on the primary key. 9/19/07 12 © 2007 Instructional Services at KU Libraries, The University of Kansas
  • 7. www.lib.ku.edu/instruction Example item color item price tax T-shirt red T-shirt 12.00 0.60 T-shirt blue polo 12.00 0.60 polo red sweatshirt 25.00 1.25 polo yellow sweatshirt blue sweatshirt black Tables are not in third normal form because: tax depends on price, not item 9/19/07 13 Example item color item price T-shirt red T-shirt 12.00 T-shirt blue polo 12.00 polo red sweatshirt 25.00 polo yellow sweatshirt blue price tax sweatshirt black 12.00 0.60 25.00 1.25 Tables are now in third normal form. 9/19/07 14 © 2007 Instructional Services at KU Libraries, The University of Kansas
  • 8. www.lib.ku.edu/instruction Another Example Name Assignment 1 Assignment 2 Jeff Smith Article Summary Poetry Analysis Nancy Jones Article Summary Reaction Paper Jane Scott Article Summary Poetry Analysis Table is not in first normal form because: Assignment field repeating First and last name in one field No (guaranteed unique) primary key field 9/19/07 15 Another Example Assignment ID Description 1 Article Summary Assignment ID Student ID 2 Poetry Analysis 1 1 3 Reaction Paper 1 2 1 3 2 1 Student ID First Name Last Name 2 3 1 Jeff Smith 3 2 2 Nancy Jones 3 Jane Scott Tables are in third normal form. 9/19/07 16 © 2007 Instructional Services at KU Libraries, The University of Kansas
  • 9. www.lib.ku.edu/instruction Relationships Relationships are created between tables using the primary key field and a foreign key field One to One Relationship One record in a table relates to one record in another table One to Many Relationship One record in a table can relate to many records in another table Many to Many Relationship Many records in one table can relate to many records in another table 9/19/07 17 Relationships in First Example item color item price T-shirt red T-shirt 12.00 T-shirt blue polo 12.00 polo red sweatshirt 25.00 polo yellow sweatshirt blue sweatshirt black price tax one to one 12.00 0.60 one to many 25.00 1.25 9/19/07 18 © 2007 Instructional Services at KU Libraries, The University of Kansas
  • 10. www.lib.ku.edu/instruction Relationships in Second Example Assignment ID Description 1 Article Summary Assignment ID Student ID 2 Poetry Analysis 1 1 3 Reaction Paper 1 2 1 3 2 1 2 3 Student ID First Name Last Name 3 2 1 Jeff Smith one to one 2 Nancy Jones one to many 3 Jane Scott many to many 9/19/07 19 Bibliography Hernandez, Michael J. Database Design for Mere Mortals. San Francisco: Addison-Wesley, 1997. Chapple, Mike. “ Database Normalization Basics.” 5 August 2001. Online. Internet. Available http://databases.about.com/library/weekly/aa080501a.htm Association for Geographic Information. GIS Dictionary. 1999. Online. Internet. Available http://www.geo.ed.ac.uk/agidexe/term?821 Wise, Barry. “Database Normalization and Design Techniques.” 1 August 2000. 6 pp. Online. Internet. Available http://www.phpbuilder.com/columns/barry20000731.php3 9/19/07 20 © 2007 Instructional Services at KU Libraries, The University of Kansas
  • 11. www.lib.ku.edu/instruction Further Reading Harrington, Jan L. Relational Database Design Clearly Explained. San Diego: Academic Express, 1998. Chapple, Mike. “Choosing a Database Product.” 6 May 2001. Online. Internet. Available http://databases.about.com/library/weekly/aa050601a.htm Gilmore, W.J. “Introduction to Database Normalization.” 27 November 2000. Online. Internet. Available http://www.devshed.com/Server_Side/MySQL/Normal/Normal 1/page1.html 9/19/07 21 © 2007 Instructional Services at KU Libraries, The University of Kansas