Normalizing TAL Example€¦ · Second Normal Form – Removal of Partial Dependencies...
Transcript of Normalizing TAL Example€¦ · Second Normal Form – Removal of Partial Dependencies...
Normalizing TAL Example
TAL Example Unnormalized
BCISTUTOR.weebly.com
Item (ItemNum, Description, OnHand, Category, Price, (OrderNum, OrderDate, CustomerNum, CustomerName, RepNum, LastName, FirstName, NumOrdered, QuotedPrice))
Functional Dependency Diagram
TAL Example Unnormalized
BCISTUTOR.weebly.com
Item (ItemNum, Description, OnHand, Category, Price, (OrderNum, OrderDate, CustomerNum, CustomerName, RepNum, LastName, FirstName, NumOrdered, QuotedPrice))
Functional Dependency Formula Primary Key: (ItemNum) F(ItemNum) Description, OnHand, Category, Price, OrderNum, OrderDate, CustomerNum, CustomerName, RepNum, LastName, FirstName, NumOrdered, QuotedPrice
TAL Example Unnormalized
BCISTUTOR.weebly.com
Item (ItemNum, Description, OnHand, Category, Price, (OrderNum, OrderDate, CustomerNum, CustomerName, RepNum, LastName, FirstName, NumOrdered, QuotedPrice))
What does the data table look like?
TAL Example First Normal Form – Removal of Repeating Groups
BCISTUTOR.weebly.com
Item (ItemNum, Description, OnHand, Category, Price) Orders (OrderNum, OrderDate, CustomerNum, CustomerName, RepNum, LastName, FirstName, NumOrdered, QuotedPrice, ItemNum)
Functional Dependency Diagram
3NF
1NF
TAL Example First Normal Form – Removal of Repeating Groups
BCISTUTOR.weebly.com
Item (ItemNum, Description, OnHand, Category, Price) Orders (OrderNum, OrderDate, (CustomerNum, CustomerName, RepNum, LastName, FirstName), NumOrdered, QuotedPrice, ItemNum)
Functional Dependency Formula Primary Key: (ItemNum) F(ItemNum) Description, OnHand, Category, Price Primary Key: (OrderNum) Foreign Key: (ItemNum) F(OrderNum) OrderDate, CustomerNum, CustomerName, RepNum, LastName, FirstName, NumOrdered, QuotedPrice, ItemNum
TAL Example First Normal Form – Removal of Repeating Groups
BCISTUTOR.weebly.com
Item (ItemNum, Description, OnHand, Category, Price) Order (OrderNum, OrderDate, CustomerNum, CustomerName, RepNum, LastName, FirstName, NumOrdered, QuotedPrice, ItemNum)
What does the data table look like?
Item Table is Fine
Still have repeating groups
TAL Example First Normal Form – Removal of Repeating Groups
BCISTUTOR.weebly.com
Item (ItemNum, Description, OnHand, Category, Price) Orders (OrderNum, OrderDate, (CustomerNum, CustomerName, RepNum, LastName, FirstName), NumOrdered, QuotedPrice, ItemNum)
Functional Dependency Formula Primary Key: (ItemNum) F(ItemNum) Description, OnHand, Category, Price Primary Key: (OrderNum) Foreign Key: (ItemNum) F(OrderNum) OrderDate, CustomerNum, CustomerName, RepNum, LastName, FirstName, NumOrdered, QuotedPrice, ItemNum
TAL Example First Normal Form – Removal of Repeating Groups
BCISTUTOR.weebly.com
Item (ItemNum, Description, OnHand, Category, Price Orders(OrderNum, OrderDate, CustomerNum, CustomerName, RepNum, LastName, FirstName) OrderLine(OrderNum, ItemNum, NumOrdered, QuotedPrice)
3NF
3NF
2NF
TAL Example First Normal Form – Removal of Repeating Groups
BCISTUTOR.weebly.com
Item (ItemNum, Description, OnHand, Category, Price) Orders (OrderNum, OrderDate, CustomerNum, CustomerName, RepNum, LastName, FirstName) OrderLine (OrderNum, ItemNum, NumOrdered, QuotedPrice) What does the data table look like?
TAL Example Second Normal Form – Removal of Repeating Groups and no
KEY Dependancies (Partial Dependancies)
BCISTUTOR.weebly.com
Orders(OrderNum, OrderDate, (CustomerNum, CustomerName, (RepNum, LastName, FirstName) ))
TAL Example Second Normal Form – Removal of Partial Dependencies
BCISTUTOR.weebly.com
Orders (OrderNum, OrderDate, CustomerNum, CustomerName, (RepNum, LastName, FirstName) Functional Dependency Formula Primary Key: (OrderNum) F(OrderNum, CustomerNum) OrderDate, CustomerNum, CustomerName, RepNum, LastName, FirstName
TAL Example Second Normal Form – Removal of Partial Dependencies
BCISTUTOR.weebly.com
Orders (OrderNum, OrderDate, CustomerNum, CustomerName, RepNum, LastName, FirstName)
What does the data table look like?
TAL Example Second Normal Form – Removal of Partial Dependencies
BCISTUTOR.weebly.com
Orders(OrderNum, OrderDate, (CustomerNum, CustomerName, (RepNum, LastName, FirstName) ))
3NF
2NF
TAL Example Second Normal Form – Removal of Partial Dependencies
BCISTUTOR.weebly.com
Orders (OrderNum, OrderDate, CustomerNum) Customer (CustomerNum, CustomerName, (RepNum, LastName, FirstName))
Functional Dependency Formula Primary Key: (OrderNum) Foreign Key: (CustomerNum) F(OrderNum, CustomerNum) OrderDate, CustomerNum Primary Key: (CustomerNum) F(CustomerNum) CustomerName, RepNum, LastName, FirstName
TAL Example Second Normal Form – Removal of Partial Dependencies
BCISTUTOR.weebly.com
Orders (OrderNum, OrderDate, CustomerNum, Customer (CustomerName, RepNum, LastName, FirstName)
What does the data table look like?
Order table in 3NF
TAL Example Third Normal Form – Removal of Transitive Dependencies
BCISTUTOR.weebly.com
Customer (CustomerNum, CustomerName, Street, City, State, PostalCode, Balance, CreditLimit, RepNum) Rep (RepNum, LastName, FirstName, Street, City, State, PostalCode, Commission, Rate)
TAL Example Third Normal Form – Removal of Transitive Dependencies
BCISTUTOR.weebly.com
Customer (CustomerNum, CustomerName, Street, City, State, PostalCode, Balance, CreditLimit, RepNum) Rep (RepNum, LastName, FirstName, Street, City, State, PostalCode, Commission, Rate)
Functional Dependency Formula Primary Key: (CustomerNum) Foreign Key: (RepNum) F(CustomerNum) CustomerName, Street, City, State, PostalCode, Balance, CreditLimit, RepNum) Primary Key: (RepNum) F(RepNum) LastName, FirstName, Street, City, State, PostalCode, Commission, Rate)
TAL Example Third Normal Form – Removal of Transitive Dependencies
BCISTUTOR.weebly.com
Customer (CustomerNum, CustomerName, Street, City, State, PostalCode, Balance, CreditLimit, RepNum) Rep (RepNum, LastName, FirstName, Street, City, State, PostalCode, Commission, Rate)
What does the data table look like?
3NF
3NF