Presentation is loading. Please wait.

Presentation is loading. Please wait.

Database Normalization Lynne Weldon July 17, 2000.

Similar presentations


Presentation on theme: "Database Normalization Lynne Weldon July 17, 2000."— Presentation transcript:

1 Database Normalization Lynne Weldon July 17, 2000

2 2 Database Basics Collection of related information organized as –Tables Information about a particular physical or conceptual object –Examples: instructors, courses, books, students –Records, represented as rows Information about a particular instance of the object –Examples: 1 instructor, 1 course, 1 book, 1 student –Fields, represented as columns Particular piece of information about the objects in the database –Examples: instructor's last name, course number, book title, student's SSN

3 3 Employee Database Table without Primary Key The Employee Table is comprised of –8 Records (1 per employee), each containing 5 Fields –Last Name, First Name, Dept Code, Dept Name, Dept Bldg Problem - No field to uniquely identify a record

4 4 Employee Database Table with Primary Key A Primary Key is one or more fields which uniquely identify a record The Employee ID field is the Primary Key for the Employee Table If you know an employee's ID, you will always be able to locate the record for that employee

5 5 Why Normalize Data? Save typing of redundant data which will reduce the effect of data entry errors Save storage space Avoid frequent restructuring of tables and other objects to accommodate new data Increase flexibility to query, sort, summarize, and group data To have the most efficiently designed tables

6 6 What is Normalization? Organizing data to minimize redundancy Successive steps followed to identify and eliminate poor table definition Each step is referred to as a "Form" –1st Normal Form (1NF) –2nd Normal Form (2NF) –3rd Normal Form (3NF) –4th Normal Form (4NF) –5th Normal Form (5NF) Database designers agree that 3NF is sufficient for most databases

7 7 Expected Outcome as Normalization Proceeds Absence of fields containing no data More database tables Less fields in each of the new database tables Elimination of non-key redundant data

8 8 Unnormalized Database Table What has to be done if an employee is assigned a fourth project? Notice the blank fields There are repeating fields to store project information for each employee Each time a new employee is added, the complete department information (3 fields) must be entered How many records must be changed if the name of a department or a building changes? (Example: Technical Writing) Notice the redundant data

9 9 Establishing First Normal Form Eliminate repeating groups of fields. Problems in the Employee Table –Repeating fields are used for each project an employee is assigned to Project Number Time Spent on Project

10 10 First Normal Form Established The table does not contain repeating groups of fields. There is one Project Number field and one Time Spent on Project field. Separate records were created for additional projects an employee is assigned.

11 11 Establishing Second Normal Form Applies to database tables that have a multiple-field primary key. Insure that each non-key field relates to the entire multiple- field primary key. Place fields that do not describe the entire multiple-field primary key in a separate table. multiple-field primary key Problems in the Employee Table –Unrelated non-key fields: Last Name, First Name, Department fields

12 12 Second Normal Form Established This table has a multiple-field primary key. Each non-key field relates to the entire primary key. All other fields were placed in a new table.

13 13 Establishing Third Normal Form Applies to database tables that have a single-field primary key. Each non-key field is a fact about the primary key. Place fields that do not describe the single-field primary key in a separate table. Problems in the Employee Table –Unrelated non-key fields: Department Name, Dept Bldg single-field primary key

14 14 Third Normal Form Established Applies to tables with a single-field primary key. Each non-key field is a fact about the primary key. About Employees About Departments These values do not describe the key; they are put in a separate table.

15 15 Employee Database in 3rd Normal Form Projects Table Departments Table Employees Table

16 16


Download ppt "Database Normalization Lynne Weldon July 17, 2000."

Similar presentations


Ads by Google