Download presentation
Presentation is loading. Please wait.
1
Kirkwood Center for Continuing Education By Fred McClurg, frmcclurg@gmail.com Introduction to PHP and MySQL Copyright © 2010 All Rights Reserved.
2
Database Design http://webcert.kirkwood.edu/~fmcclurg/c ourses/php/slides/chapter09b.design.ppt Chapter Nine
3
Flat File Disadvantages: Spreadsheet Structure No relationships No data sharing (data is repeated) Multiple updates on data No hierarchy LastFirstAddressCityLocationCountry McClurgFred1640 Fawn DriveNorth LibertyHomeUSA McClurgFred200 Hawkins DriveIowa CityWorkUSA McClurgMartha1640 Fawn DriveNorth LibertyHomeUSA Why Use a Database?
4
LastFirstAddressCityLocationCountry McClurgFred1640 Fawn DriveNorth LibertyHomeUSA McClurgFred200 Hawkins DriveIowa CityWorkUSA McClurgMartha1640 Fawn DriveNorth LibertyHomeUSA Initial Database Design Questions Design Questions: 1.What data do I need to display? 2.What data is used internally? (employee number) 3.What data can be reused? 4.What data should be entered upon creation? 5.What data is unnecessary? (country if only USA) 6.What data might be missing? (state location) 7.What data is mandatory? (use NOT NULL) 8.What data is optional? 9.What are the field widths? (VARCHAR sizes)
5
Primary Keys Purpose: Used as unique identifier to a database row (record). Characteristics: 1.Unique values (past, present, future?) 2.Value does not change 3.Only one primary key per table Examples: A.Poor Primary: Last Name B.Mediocre Key: Social Security Number C.Excellent Primary: Unique Integer
6
Foreign Keys Purpose: Establishes a relationship to primary key Examples: Employee (primary) links to boss (foreign) User (primary) links to purchase (foreign) City (primary) link to state (foreign)
7
to be continued... http://webcert.kirkwood.edu/~fmcclurg/cour ses/php/slides/chapter09c.relationships.ppt
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.