Lecture 1: Normalization (Chapter 11 of LIU)
- Criteria for a good database design
- Issues with data redundancies
- The concept of normalization
- Functional dependency: Tables 1 and 2
- First Normal Form: Tables 3
- Second Normal Form: Tables 1 and 5
- Third Normal Form: Author Editor Example and Job Class Example
Lecture 2: Normal Forms
- Third Normal Form: Table 6
- Boyce-Codd Normal Form
Additional Examples:
Assume a customer can make several loans, with or without other partners. Each branch can can write loans independently but no two loans have the same loan number. List all possible functional dependencies among the attributes/columns in the following tables. Are the tables in 1st normal form? Why? Are the tables in the 2nd and 3rd normal form? Why? Draw the Entity Relationship Diagram to to show the original data model for the resulting relational model after fixing the normal form violations.
Customer (SSN, Name, Street, City, BankBranch, Branch_City)
Loan_Info (BranchName, CustomerID, Loan_number, Amount)
Lecture 3: Boyce Codd Normal Forms
Every determinant must be a key or the table violate BCNF.
Example 1: Bank Loan Table (Note two different cases: 1) Each branch issues loans independently; 2) Each branch issues loans for the bank
Assume a customer can make several loans, with or without other partners. Each branch can can write loans independently but no two loans have the same loan number. List all possible functional dependencies among the attributes/columns in the following tables. Are the tables in 1st normal form? Why? Are the tables in the 2nd and 3rd normal form? Why? Draw the Entity Relationship Diagram to to show the original data model for the resulting relational model after fixing the normal form violations.
Customer (SSN, Name, Street, City, BankBranch, Branch_City)
Loan_Info (BranchName, CustomerID, Loan_number, Amount)
Example 2: Warehouse Table
Conceptual Questions:
- Does Boyce-Codd norm form require the 3rd normal form to begin with?
- What is the difference between the 3rd and Boyce-Codd normal form?
- Give an example of the violation of the Boyce-Codd normal Form.
Additional Exercise:
1) Is the following table in BCNF? If not, fix it to be so.
|
Name
|
SSN
|
Street
|
City
|
Acct No
|
Balance
|
|
Shiver
|
508-08-0808
|
North
|
Albany
|
908
|
1,080
|
|
Shiver
|
508-08-0808
|
North
|
Albany
|
805
|
5,000
|
|
Rodies
|
510-10-1010
|
South
|
Macon
|
805
|
5,000
|
|
Rodies
|
510-10-1010
|
South
|
Macon
|
105
|
1,050
|
|
Doe
|
509-09-0909
|
|
|
110
|
110,000,000
|
2) Identify the functional dependencies in the following tables and then states whether each one is in 1st normal form and 2nd normal form or not. If not, fix it.
|
OrderID
|
OrderDate
|
CustomerID
|
CName
|
CAddress
|
ItemID
|
ItemName
|
UnitPrice
|
QTY
|
SubTotal
|
OrderTotal
|
|
103
|
10/5/98
|
1002
|
Cooper
|
3256 Grand Avenue
|
1015
1010
1025
|
Toaster
Blender
Television
|
19.95
29.95
699.95
|
1
1
2
|
19.95
29.95
1399.9
|
1459.8
|
|
|
|
|
|
108
|
10/16/98
|
1000
|
Kris
|
637 Johnson Street
|
1025
1045
|
Clock
|
99.95
|
1
1
|
99.95
|
799.9
|
|
|
|
110
|
10/24/98
|
1002
|
|
|
1045
|
|
|
3
|
299.95
|
299.95
|
Review Questions:
- What is the deletion anomaly?
- Write one sentence to summary 2nd and 3rd normal forms
- Under what conditions, the 2nd normal form is automatically satisfied if a relation is in the 1st normal form?
- What is the procedure to convert a relation that violates 3NF into ones in 3NF?
Homework:
Reading: Chapter 11
Hands-on Questions (due along with HW6 hands-on Questions):
1) Identify the functional dependencies in the following table and then states whether each one is in 1st normal form, 2nd normal form, and 3rd normal form or not. If not, fix it for each normal form in order. (Hint: mapping cardinality between Customer and Order)
|
Customer ID
|
OrderID
|
OrderAmt
|
OrderDate
|
CustomerName
|
Email
|
|
9087
|
375
|
234.45
|
01/31/98
|
John Doe
|
Doe@ibm.net
|
|
9087
|
123
|
1500.00
|
03/09/97
|
John Doe
|
Doe@ibm.net
|
|
2398
|
378
|
234.45
|
09/21/97
|
Laura Smith
|
ls@ms.com
|
|
2398
|
379
|
234.45
|
12/31/97
|
Laura Smith
|
ls@ms.com
|
|
2398
|
128
|
1500.00
|
02/01/98
|
Laura Smith
|
ls@ms.com
|
2) Normal Forms: (a) Does the following table confirm to the 2nd normal form? Explain the reason. If not, decompose it into 2nd normal form relations.
|
Name
|
SSN
|
Street
|
City
|
Acct No
|
Balance
|
|
Shiver
|
508-08-0808
|
North
|
Albany
|
908
|
1,080
|
|
Shiver
|
508-08-0808
|
North
|
Albany
|
805
|
5,000
|
|
Rodies
|
510-10-1010
|
South
|
Macon
|
805
|
5,000
|
|
Rodies
|
510-10-1010
|
South
|
Macon
|
105
|
1,050
|
|
Doe
|
509-09-0909
|
|
|
110
|
110,000,000
|
|