Professional Documents
Culture Documents
2
Keys
The role of the key is based on a concept known as
determination, which is used in the definition of functional
dependence.
An attribute B is functionally dependent on an attribute
A if the value of A determines the value of B.
An attribute that is part of a primary or candidate key is
known as a key ( or prime) attribute. Else, it is a non-
key (or non-prime) attribute.
If an attribute B is functionally dependent on a composite
key A but not on any subset of A, then B is fully
functionally dependent on A; otherwise B is partially
dependent on A.
3
Two Other Dependencies
Partial Dependency
A functional dependency ‘A determines B’ is a partial
dependency if the dependency holds even after removing
some attribute from A.
Transitive Dependency
A transitive dependency occurs when one non-prime attribute
depends on another non-prime attribute.
4
Database Tables and Normalization
1NF Definition
The term First Normal Form (1NF) describes the
tabular format in which:
All the prime attributes are defined and have
non-null values.
All table entries are atomic, i.e., no cell of the
table contains a group of items.
All attributes are dependent on the primary key.
5
Customer
Customer ID First Name Surname Tel. No. 1 Tel. No. 2 Tel. No. 3
123 Robert Ingram 2025456
124 Jane Wright 555-403-1 659555-776-
Customer
Customer ID First Name Surname
1 Robert Ingram
2 Jane Wright
Customer Telephone Number
Customer ID Telephone Number
1 2025456
2 555-403-1
124 659555-776-
6
Database Tables and Normalization
2NF Definition
A table is in Second Normal Form (2NF) if:
It is in 1NF, and
It includes no partial dependencies, i.e., no
attribute is dependent on only a part of a
composite candidate key.
Note that it is possible for a table in 2NF to
exhibit transitive dependency, i.e., a non-prime
attribute can be functionally dependent on some
other non-prime attribute.
7
Consider a table describing employees' skills:
8
A 2NF alternative to this design would represent the same information
in two tables:
Employees
Employee Location
Current Work
Jones 114 Main Street
Roberts 73 Industrial Way
Employees' Skills
Employee Skill
Jones Typing
Jones Shorthand
Jones Whittling
Roberts Light Cleaning
9
Database Tables and Normalization
3NF Definition
A table is in Third Normal Form (3NF) if:
It is in 2NF, and
10
11
To normalize data to achieve third normal
form-
12
13
Denormalization
Normalization is only one of many database design
goals.
Normalized (decomposed) tables require additional
processing.
Normalizationpurity is often difficult to sustain in
the modern database environment. The conflict
between design efficiency, information require-
ments, and processing speed are often resolved
through compromises that include denormalization.
14
Merging Relations (View Integration)
This is required when, on large projects, the
work of several sub-teams comes together
during logical design.
Homonyms
STUDENT1 (Student_ID, Name, Address)
STUDENT2 (Student_ID, Name, Phone, Address)
If one address refers to the campus address and the other to the home
address, the relations can be merged to