normalization mis335 database systems. why normalization? optimizing database structure removing...

Post on 18-Jan-2016

217 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Normalization

MIS335 Database Systems

Why Normalization?

• Optimizing database structure• Removing duplications• Accelerating the instructions• Data integrity!

Normalization Terms

• Functional dependency– X -> Y– Y has a functional dependency on X– For example, {StudentID} -> {StudentEmail}

• Transitive dependency– If X->Y and Y-> Z, then X-> Z

• Superkey– Combination of attributes for uniquely identifying

database records– There may be several superkeys.

Normalization Terms

• Candidate key– Subset of superkey – Minimal superkey– Student table with <studentID>, <name>, <age>• <studentID, name> is a superkey• <studentID> is the candidate key because it can define

a tuple uniquely.

• Primary key– One of the candidate key

Normalization Steps

• 1NF• 2NF• 3NF• BCNF (Boyce-Codd)• 4NF• 5NF– 4NF and 5NF are not used for this course.

1NF

• Each attribute contains only atomic values– Atomic value cannot be decomposed.

• If each attribute contains atomic values, that relation is in first-normal form.

1NF

1NF

2NF

• Non-key values must depend on entire primary key, not only part of primary key

2NF

3NF

• All non-key values depend only on primary key, not any other.

3NF

An example...

PK(customer_id, Order_id)

top related