10
Module III: The Normal Forms

Module III: The Normal Forms. Edgar F. Codd first proposed the process of normalization and what came to be known as the 1st normal form. The database

Embed Size (px)

Citation preview

Page 1: Module III: The Normal Forms. Edgar F. Codd first proposed the process of normalization and what came to be known as the 1st normal form. The database

Module III: The Normal Forms

Page 2: Module III: The Normal Forms. Edgar F. Codd first proposed the process of normalization and what came to be known as the 1st normal form. The database

•  • Edgar F. Codd first proposed the process of 

normalization and what came to be known as the 1st normal form. 

• The database community has developed a series of guidelines for ensuring that databases are normalized.

•  These are referred to as normal forms and are numbered from one (the lowest form of normalization, referred to as first normal form or 1NF) through five (fifth normal form or 5NF). In practical applications, you'll often see 1NF, 2NF, and 3NF along with the occasional 4NF.

Page 3: Module III: The Normal Forms. Edgar F. Codd first proposed the process of normalization and what came to be known as the 1st normal form. The database

Topic 1: First Normal Form

• First normal form (1NF) sets the very basic rules for an organized database: – Eliminate duplicative columns from the same table. 

– Create separate tables for each group of related data and identify each row with a unique column or set of columns (the primary key). 

Page 4: Module III: The Normal Forms. Edgar F. Codd first proposed the process of normalization and what came to be known as the 1st normal form. The database

• We must not duplicate data within the same row of a table. Within the database community, this concept is referred to as the atomicity of a table. Tables that comply with this rule are said to be atomic.

Page 5: Module III: The Normal Forms. Edgar F. Codd first proposed the process of normalization and what came to be known as the 1st normal form. The database

• For example, to track an inventory item that may come from two possible sources, an inventory record may contain fields for Vendor Code 1 and VendorCode2. What happens when you add a third vendor? Adding a field is not the answer; it requires program and table modifications and does not smoothly accommodate a dynamic number of vendors. Instead, place all vendor information in a separate table called Vendors, then link inventory to vendors with an item number key, or vendors to inventory with a vendor code key.

Page 6: Module III: The Normal Forms. Edgar F. Codd first proposed the process of normalization and what came to be known as the 1st normal form. The database

Topic 2: Second Normal Form (2NF)

• Second normal form (2NF) further addresses the concept of removing duplicative data: –Meet all the requirements of the first normal form. 

– Remove subsets of data that apply to multiple rows of a table and place them in separate tables. 

– Create relationships between these new tables and their predecessors through the use of foreign keys. 

Page 7: Module III: The Normal Forms. Edgar F. Codd first proposed the process of normalization and what came to be known as the 1st normal form. The database

• Records should not depend on anything other than a table's primary key (a compound key, if necessary). 

• For example, consider a customer's address in an accounting system. The address is needed by the Customers table, but also by the Orders, Shipping, Invoices, Accounts Receivable, and Collections tables. Instead of storing the customer's address as a separate entry in each of these tables, store it in one place, either in the Customers table or in a separate Addresses table. 

Page 8: Module III: The Normal Forms. Edgar F. Codd first proposed the process of normalization and what came to be known as the 1st normal form. The database

Topic 3: Third Normal Form (3NF)

• Third normal form (3NF) goes one large step further: – Meet all the requirements of the second normal form. – Remove columns that are not dependent upon the primary key. 

• Values in a record that are not part of that record's key do not belong in the table. In general, any time the contents of a group of fields may apply to more than a single record in the table, consider placing those fields in a separate table. 

Page 9: Module III: The Normal Forms. Edgar F. Codd first proposed the process of normalization and what came to be known as the 1st normal form. The database

• For example, in an Employee Recruitment table, a candidate's university name and address may be included. But you need a complete list of universities for group mailings. If university information is stored in the Candidates table, there is no way to list universities with no current candidates. Create a separate Universities table and link it to the Candidates

• Table with a university code key

Page 10: Module III: The Normal Forms. Edgar F. Codd first proposed the process of normalization and what came to be known as the 1st normal form. The database

Other normalization forms

• Fourth normal form, also called Boyce Codd Normal Form (BCNF), and fifth normal form do exist, but are rarely considered in practical design.

•  Disregarding these rules may result in less than perfect database design, but should not affect functionality.