PHPBuilder - Database Normalization and Design Techniques Page 3



RSS Twitter
Articles Databases

Database Normalization and Design Techniques - Page 3

by: Barry Wise
|
July 31, 2000

Second Normal Form

  1. Create separate tables for sets of values that apply to multiple records.
  2. Relate these tables with a foreign key.

We break the url values into a separate table so we can add more in the future without having to duplicate data. We'll also want to use our primary key value to relate these fields:
users
userId name company company_address
1 Joe ABC 1 Work Lane
2 Jill XYZ 1 Job Street

urls
urlId relUserId url
1 1 abc.com
2 1 xyz.com
3 2 abc.com
4 2 xyz.com
Ok, we've created separate tables and the primary key in the users table, userId, is now related to the foreign key in the urls table, relUserId. We're in much better shape. But what happens when we want to add another employee of company ABC? Or 200 employees? Now we've got company names and addresses duplicating themselves all over the place, a situation just rife for introducing errors into our data. So we'll want to look at applying the Third Normal Form:

« Previous Page
1
|
2
|
3
|
4
|
5
|
6
Next Page »

Comment and Contribute

Your comment has been submitted and is pending approval.

Author:
Barry Wise

Comment:



Comment:

(Maximum characters: 1200). You have characters left.