Presentation is loading. Please wait.

Presentation is loading. Please wait.

Kirkwood Center for Continuing Education By Fred McClurg, Introduction to PHP and MySQL Copyright © 2015, Fred McClurg, All Rights.

Similar presentations


Presentation on theme: "Kirkwood Center for Continuing Education By Fred McClurg, Introduction to PHP and MySQL Copyright © 2015, Fred McClurg, All Rights."— Presentation transcript:

1 Kirkwood Center for Continuing Education By Fred McClurg, frmcclurg@gmail.com Introduction to PHP and MySQL Copyright © 2015, Fred McClurg, All Rights Reserved.

2 Database Design http://cecert.kirkwood.edu/~fmcclurg/courses/p hp/slides/chapter09b.design.ppt Chapter Nine 2

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? 3

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) 4

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 5

6 Foreign Keys Purpose: Establishes a relationship to primary key Examples: Employee (foreign) links to boss (primary) User (foreign) links to purchase (primary) Zip Code has two foreign keys which link to city (primary) and state (primary) 6

7 to be continued... http://cecert.kirkwood.edu/~fmcclurg/courses/php/ slides/chapter09c.relationships.ppt http://cecert.kirkwood.edu/~fmcclurg/courses/php/ slides/chapter09c.relationships.ppt7


Download ppt "Kirkwood Center for Continuing Education By Fred McClurg, Introduction to PHP and MySQL Copyright © 2015, Fred McClurg, All Rights."

Similar presentations


Ads by Google