SQLTrainingOnline DatabaseNormalization
SQLTrainingOnline DatabaseNormalization
Customer Customer
Customer Email Mail Mail
Customer Customer Address Subscriptions Catalogs 1 Catalogs 2
123 Broadway Dr;
Bob Smith [email protected] Baseball, Basketball Basketball Golf
123 Broadway Dr;
Bob Smith [email protected] Baseball, Basketball Basketball Golf
123 Broadway Dr;
Bob Smith [email protected] Baseball, Basketball Basketball Golf
12 Kellogg Ave;
Jill Thomas [email protected] Baseball Baseball
12 Kellogg Ave;
Jill Thomas [email protected] Baseball Baseball
5 Maple Street;
Bob Smith [email protected] Golf Golf Baseball
5 Maple Street;
Bob Smith [email protected] Golf Golf Baseball
Column Definitions
Column Description
Customer Name of the customer that purchased the product. **Be careful, it is n
Customer Address Contains the Physical Home Address and the Email Address of the custo
Customer Email Subscriptions If the Customer is subscripted to an email list, it will be in this column.
Customer Mail Catalogs 1 If the customer wants a catalog at home, this contains the first catalog s
Customer Mail Catalogs 1 If the customer wants a catalog at home, this contains the second catalo
Product This is the product that was purchased by the customer. **Be careful, i
Product Manufacturer The manufacture of the product that was purchased.
Product Manufacturer Address The address of the manufacturer.
Product Details Extra details about the purchased product. The is one product detail pe
Product Cost The cost/price of the product. In this example, the cost does not chang
Quantity The number of items of a product purchased.
Total Line Amount The Product Cost multiplied by the Quantity
Order Date The date the whole order was placed. We are assuming a customer can
Order Total A sum of all of the total line amounts for an order.
Product Total
Product Manufacturer Product Product Line Order
Product Manufacturer Address Details Cost Quantity Amount Order Date Total
1 Spaulding
Basketball Spaulding Drive 29.5 Inch $25 1 $25 8/9/2018 $70
Louisville 345 Slugger
Bat Slugger Avenue 33 Inch $35 1 $35 8/9/2018 $70
1 Spaulding
Basketball Spaulding Drive 29.5 Inch $23 1 $23 8/12/2018 $23
23 Rawlings
Softball Rawlings Court 4 Pack $6 2 $12 8/10/2018 $57
23 Rawlings
Bat Rawlings Court 32 Inch $45 1 $45 8/10/2018 $57
1234 Titleist
Golf Balls Titleist Road 1 Dozen $44 2 $88 8/12/2018 $88
1234 Titleist
Basketball Titleist Road 1 Dozen $44 2 $88 8/12/2018 $88
d. We are assuming a customer can only order 1 time per day, but they can have multiple products.
s for an order.
Customer Customer
Customer Email Mail Mail
Customer Customer Address Subscriptions Catalogs 1 Catalogs 2 Product
123 Broadway Dr;
Bob Smith [email protected] Baseball, Basketball Basketball Golf Basketball
123 Broadway Dr;
Bob Smith [email protected] Baseball, Basketball Basketball Golf Bat
123 Broadway Dr;
Bob Smith [email protected] Baseball, Basketball Basketball Golf Basketball
12 Kellogg Ave;
Jill Thomas [email protected] Baseball Baseball Softball
12 Kellogg Ave;
Jill Thomas [email protected] Baseball Baseball Bat
5 Maple Street;
Bob Smith [email protected] Golf Golf Baseball Golf Balls
5 Maple Street;
Bob Smith [email protected] Golf Golf Baseball Basketball
1st Normal Form The information is stored in a relational table and each column contains
Atomic Values
2nd Normal Form The table is in first normal form and all the columns depend on the tabl
Composite Keys/Partial Dependence
3rd Normal Form The table is in second normal form and all of its columns are not transiti
Transitive Dependence
4th Normal Form The table is in third normal form and does not contain two or more ind
Multi-Valued Facts
Product Total
Product Manufacturer Product Product Line Order
Manufacturer Address Details Cost Quantity Amount Order Date Total
1 Spaulding
Spaulding Drive 29.5 Inch $25 1 $25 8/9/2018 $70
Louisville 345 Slugger
Slugger Avenue 33 Inch $35 1 $35 8/9/2018 $70
1 Spaulding
Spaulding Drive 29.5 Inch $23 1 $23 8/12/2018 $23
23 Rawlings
Rawlings Court 4 Pack $6 2 $12 8/10/2018 $57
23 Rawlings
Rawlings Court 32 Inch $45 1 $45 8/10/2018 $57
1234 Titleist
Titleist Road 1 Dozen $44 2 $88 8/12/2018 $88
1234 Titleist
Titleist Road 1 Dozen $44 2 $88 8/12/2018 $88
and each column contains atomic values, and there are not repeating groups of columns.
Example #2:
Customer Email
Customer Subscriptions
Bob Smith Baseball, Basketball
Jill Thomas Baseball
Bill Smith Golf, Basketball
Example #3:
Customer
Customer Mail Catalogs Customer Mail Mail
Customer 1 Catalogs 2 Catalogs 3
Bob Smith Basketball Golf Baseball
Jill Thomas Baseball
Bill Smith Golf Baseball
h column contains atomic values, and there are not repeating groups of columns.
1st Normal Form The information is stored in a relational table and each column contains atom
Atomic Values
Example #1:
Customer Customer Address Customer
123 Broadway Dr;
Bob Smith [email protected] Bob Smith
12 Kellogg Ave;
Jill Thomas [email protected] Jill Thomas
5 Maple Street;
Bill Smith [email protected] Bill Smith
Example #2:
Customer Email
Customer Subscriptions Customer
Bob Smith Baseball, Basketball Bob Smith
Jill Thomas Baseball Bob Smith
Bill Smith Golf, Basketball Jill Thomas
Bill Smith
Example #3: Bill Smith
Customer
Customer Mail Catalogs Customer Mail Mail
Customer 1 Catalogs 2 Catalogs 3
Bob Smith Basketball Golf Baseball Customer
Jill Thomas Baseball Bob Smith
Bill Smith Golf Baseball Bob Smith
Bob Smith
Jill Thomas
Bill Smith
Bill Smith
h column contains atomic values, and there are not repeating groups of columns.
Customer Email
Subscriptions
Baseball
Basketball
Baseball
Golf
Basketball
Customer Order
Foreign Key Foreign Key
Customer Product Order Date Quantity
Bob Smith Basketball 8/9/2018 1
Bob Smith Bat 8/9/2018 2
Jill Thomas Bat 8/10/2018 1
Mark Smith Golf Balls 8/12/2018 2
Mark Smith Basketball 8/12/2018 2
Product Manufacturer
Spaulding
Louisville Slugger
Titleist
3rd Normal Form The table is in second normal form and all of its columns are not transitive
Transitive Dependence
Product
Manufacturer
Product Product Manufacturer Address Product Details
Basketball Spaulding 1 Spaulding Drive 29.5 Inch
Bat Rawlings 23 Rawlings Court 33 Inch
Softball Rawlings 23 Rawlings Court 4 Pack
Golf Balls Titleist 1234 Titleist Road 1 Dozen
and all of its columns are not transitively dependent on the primary key
Product Cost
$25
$35
$6
$44
3rd Normal Form The table is in second normal form and all of its columns are not transitive
Transitive Dependence
Product
Manufacturer
Product Product Manufacturer Address Product Details
Basketball Spaulding 1 Spaulding Drive 29.5 Inch
Bat Rawlings 23 Rawlings Court 33 Inch
Softball Rawlings 23 Rawlings Court 4 Pack
Golf Balls Titleist 1234 Titleist Road 1 Dozen
Product Manufacturer
Spaulding
Rawlings
Titleist
Product Table
Primary Key Foreign Key
Product Product Manufacturer Product Details Product Cost
Basketball Spaulding 29.5 Inch $25
Bat Rawlings 33 Inch $35
Softball Rawlings 4 Pack $6
Golf Balls Titleist 1 Dozen $44
and all of its columns are not transitively dependent on the primary key
Product Cost
$25
$35
$6
$44
Manufacturer Table
Product Manufacturer
Address
1 Spaulding Drive
23 Rawlings Court
1234 Titleist Road
4th Normal Form The table is in third normal form and does not contain two or more indepen
Multi-Valued Facts
Customer Email
Customer Customer Address Customer Email Address Subscriptions
Bob Smith 123 Broadway Dr [email protected] Baseball, Basketball
Jill Thomas 12 Kellogg Ave [email protected] Baseball
Bill Smith 5 Maple Street [email protected] Golf
es not contain two or more independent multi-valued facts about an entity
4th Normal Form The table is in third normal form and does not contain two or more indepen
Multi-Valued Facts
Customer Email
Customer Customer Address Customer Email Address Subscriptions
Bob Smith 123 Broadway Dr [email protected] Baseball, Basketball
Jill Thomas 12 Kellogg Ave [email protected] Baseball
Bill Smith 5 Maple Street [email protected] Golf
Customer Email
Customer Customer Address Customer Email Address Subscriptions
Bob Smith 123 Broadway Dr [email protected] Baseball
Bob Smith 123 Broadway Dr [email protected] Basketball
Jill Thomas 12 Kellogg Ave [email protected] Baseball
Bill Smith 5 Maple Street [email protected] Golf
Primary Key
Customer Customer Address Customer Email Address
Bob Smith 123 Broadway Dr [email protected]
Jill Thomas 12 Kellogg Ave [email protected]
Bill Smith 5 Maple Street [email protected]
es not contain two or more independent multi-valued facts about an entity
Foreign Key
Customer Customer Email Subscriptions
Bob Smith Baseball
Bob Smith Basketball
Jill Thomas Baseball
Bill Smith Golf
Not Normalized
Issues: Has issues with 1NF, 2NF, 3NF, and 4NF
Customer Customer
Customer Email Mail Mail
Customer Customer Address Subscriptions Catalogs 1 Catalogs 2 Product
123 Broadway Dr;
Bob Smith [email protected] Baseball, Basketball Basketball Golf Basketball
123 Broadway Dr;
Bob Smith [email protected] Baseball, Basketball Basketball Golf Bat
123 Broadway Dr;
Bob Smith [email protected] Baseball, Basketball Basketball Golf Basketball
12 Kellogg Ave;
Jill Thomas [email protected] Baseball Baseball Softball
12 Kellogg Ave;
Jill Thomas [email protected] Baseball Baseball Bat
5 Maple Street;
Bob Smith [email protected] Golf Golf Baseball Golf Balls
5 Maple Street;
Bob Smith [email protected] Golf Golf Baseball Basketball
Products
Product Product
Product ID Product Manufacturer Product Details Cost
Product Manufacturer
Product Manufacturer
Product Manufacturer Address
Spaulding 1 Spaulding Drive
Louisville Slugger 345 Slugger Avenue
Rawlings 23 Rawlings Court
Titleist 1234 Titleist Road
**Primary Keys in Yellow
**Foreign Keys in Orange
Customer Orders
Customer Order ID Customer ID Order Date Order Total
1 bsmith1 8/9/2018 $70
2 jthomas1 8/10/2018 $57
3 bsmith1 8/12/2018 $23
4 bsmith2 8/12/2018 $88
Customers
Baseball
Golf
Baseball