Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 st, 2 nd, and 3 rd Normal Forms By Carlos Alvarado San Jose State University.

Similar presentations


Presentation on theme: "1 st, 2 nd, and 3 rd Normal Forms By Carlos Alvarado San Jose State University."— Presentation transcript:

1 1 st, 2 nd, and 3 rd Normal Forms By Carlos Alvarado San Jose State University

2 Overview Today we’ll talk about: Today we’ll talk about: Database Normalization Database Normalization Data Anomalies Caused by: Data Anomalies Caused by: Update, Insertion, Deletion Update, Insertion, Deletion Brief History/Overview Brief History/Overview 1 st Normal Form 1 st Normal Form 2 nd Normal Form 2 nd Normal Form 3 rd Normal Form 3 rd Normal Form Conclusion Conclusion

3 Database Normalization The main goal of Database Normalization is to restructure the logical data model of a database to: The main goal of Database Normalization is to restructure the logical data model of a database to: Eliminate redundancy Eliminate redundancy Organize data efficiently Organize data efficiently Reduce the potential for data anomalies. Reduce the potential for data anomalies.

4 Data Anomalies Data anomalies are inconsistencies in the data stored in a database as a result of an operation such as update, insertion, and/or deletion. Data anomalies are inconsistencies in the data stored in a database as a result of an operation such as update, insertion, and/or deletion. Such inconsistencies may arise when have a particular record stored in multiple locations and not all of the copies are updated. Such inconsistencies may arise when have a particular record stored in multiple locations and not all of the copies are updated. We can prevent such anomalies by implementing 7 different level of normalization called Normal Forms (NF) We can prevent such anomalies by implementing 7 different level of normalization called Normal Forms (NF) We’ll only look at the first three. We’ll only look at the first three.

5 Brief History/Overview Database Normalization was first proposed by Edgar F. Codd. Database Normalization was first proposed by Edgar F. Codd. Codd defined the first three Normal Forms, which we’ll look into, of the 7 known Normal Forms. Codd defined the first three Normal Forms, which we’ll look into, of the 7 known Normal Forms. In order to do normalization we must know what the requirements are for each of the three Normal Forms that we’ll go over. In order to do normalization we must know what the requirements are for each of the three Normal Forms that we’ll go over. One of the key requirements to remember is that Normal Forms are progressive. That is, in order to have 3 rd NF we must have 2 nd NF and in order to have 2 nd NF we must have 1 st NF. One of the key requirements to remember is that Normal Forms are progressive. That is, in order to have 3 rd NF we must have 2 nd NF and in order to have 2 nd NF we must have 1 st NF.

6 1 st Normal Form The Requirements The requirements to satisfy the 1 st NF: The requirements to satisfy the 1 st NF: Each table has a primary key: minimal set of attributes which can uniquely identify a record Each table has a primary key: minimal set of attributes which can uniquely identify a record The values in each column of a table are atomic (No multi-value attributes allowed). The values in each column of a table are atomic (No multi-value attributes allowed). There are no repeating groups: two columns do not store similar information in the same table. There are no repeating groups: two columns do not store similar information in the same table.

7 1 st Normal Form Example Un-normalized Students table: Normalized Students table: Student#AdvIDAdvNameAdvRoomClass1Class2 123123AJames555102-8104-9 124123BSmith467209-0102-8 Student#AdvIDAdvNameAdvRoomClass#123123AJames555102-8 123123AJames555104-9 124123BSmith467209-0 124123BSmith467102-8

8 2 nd Normal Form The Requirements The requirements to satisfy the 2 nd NF: The requirements to satisfy the 2 nd NF: All requirements for 1 st NF must be met. All requirements for 1 st NF must be met. Redundant data across multiple rows of a table must be moved to a separate table. Redundant data across multiple rows of a table must be moved to a separate table. The resulting tables must be related to each other by use of foreign key. The resulting tables must be related to each other by use of foreign key.

9 2 nd Normal Form Example Students table Registration table Student#AdvIDAdvNameAdvRoom 123123AJames555 124123BSmith467 Student#Class#123102-8 123104-9 124209-0 124102-8

10 3 rd Normal Form The Requirements The requirements to satisfy the 3 rd NF: The requirements to satisfy the 3 rd NF: All requirements for 2 nd NF must be met. All requirements for 2 nd NF must be met. Eliminate fields that do not depend on the primary key; Eliminate fields that do not depend on the primary key; That is, any field that is dependent not only on the primary key but also on another field must be moved to another table. That is, any field that is dependent not only on the primary key but also on another field must be moved to another table.

11 3 rd Normal Form Example Students table: Student table:Advisor table: Student#AdvIDAdvNameAdvRoom 123123AJames555 124123BSmith467 Student#AdvID123123A 124123BAdvIDAdvNameAdvRoom123AJames555 123BSmith467

12 3 rd Normal Form Example Cont. Students table: Registration table:Advisor table: Student#Class# 123102-8 123104-9 124209-0 124102-8 AdvIDAdvNameAdvRoom123AJames555 123BSmith467 Student#AdvID123123A 124123B

13 Conclusion We have seen how Database Normalization can decrease redundancy, increase efficiency and reduce anomalies by implementing three of seven different levels of normalization called Normal Forms. The first three NF’s are usually sufficient for most small to medium size applications. We have seen how Database Normalization can decrease redundancy, increase efficiency and reduce anomalies by implementing three of seven different levels of normalization called Normal Forms. The first three NF’s are usually sufficient for most small to medium size applications.

14 References Hillyer Mike, MySQL AB. An Introduction to Database Normalization, http://dev.mysql.com/tech-resources/articles/intro-to-normalization.html, accessed October 17, 2006. Hillyer Mike, MySQL AB. An Introduction to Database Normalization, http://dev.mysql.com/tech-resources/articles/intro-to-normalization.html, accessed October 17, 2006. http://dev.mysql.com/tech-resources/articles/intro-to-normalization.html Microsoft. Description of the database normalization basics, http://support.microsoft.com/kb/283878, accessed October 17, 2006. Microsoft. Description of the database normalization basics, http://support.microsoft.com/kb/283878, accessed October 17, 2006. http://support.microsoft.com/kb/283878 Wikipedia. Database Normalization. http://en.wikipedia.org/wiki/Database_normalization.html, accessed October 17, 2006. Wikipedia. Database Normalization. http://en.wikipedia.org/wiki/Database_normalization.html, accessed October 17, 2006. http://en.wikipedia.org/wiki/Database_normalization.html


Download ppt "1 st, 2 nd, and 3 rd Normal Forms By Carlos Alvarado San Jose State University."

Similar presentations


Ads by Google