Professional Documents
Culture Documents
Normalization
• Rule Zero
• The system must qualify as relational, as a database, and
as a management system. For a system to qualify as a
relational database management system (RDBMS), that
system must use its relational facilities (exclusively) to
manage the database.
• The other 12 rules derive from this rule. The rules are as
follows :
Rule 1: Information rule
All information(including metadata) is to be represented as
stored data in cells of tables. The rows and columns have to
be strictly unordered.
1 Zayn 24
2 Phobe 34
3 Hikki 26
4 David 29
•Here, { Employee_Id →
Department } and { Department → Street
Number } holds true. Hence, according to the axiom of
transitivity, { Employee_Id → Street Number } is a valid
functional dependency.
• Fully Functional Dependency
• It occurs only in a relation with composite
primary key. It occurs when one or more non
key attributes are depending on all parts of the
composite key.
• Partial Dependency
• Partial Dependency occurs when a nonprime
attribute is functionally dependent on part of a
candidate key.
• The 2nd Normal Form (2NF) eliminates the
Partial Dependency.
<StudentProject>
The prime key attributes are StudentID and ProjectNo.
As stated, the non-prime
attributes .e. StudentName and ProjectName
should be functionally dependent on part of a candidate key, to be
Partial Dependent.
The StudentName can be determined by StudentID that makes
the relation Partial Dependent.
The ProjectName can be determined by ProjectID,
which that the relation Partial Dependent.
Decompos
e
R1(A,B) R2(A,C)
Recove
r
R’(A,B,C) should be the same as
R(A,B,C)
Must ensure R’ = R
• Lossless Join Decomposition :
• "The decomposition of relation R into R1 and
R2 is lossless when the join of R1 and R2 yield
the same relation as in R."
STUDENT :
Stu_name: Stu_dept :
<EmpDetails>
<DeptDetails>
Dept_ID Dept_Name
Dpt1 Operations
Dpt2 HR
Dpt3 Finance
Now, you won’t be able to join the above tables, since Emp_ID isn’t part of
the DeptDetails relation.
Conclusion
Decomposing is the act of breaking tables down in
order to achieve higher normal form.
2NF
PROJ_NUM,EMP_NUM-PROJ_NAME,EMP_NAME,JOB_CLASS,CHG_HOURS,HOURS.
Example
PROJ_NUM PROJ_NAME.
EMP_NUMEMP_NAME,JOB_C LASS,CHG_HOURS.
.
Conversion to 2NF
• There are only two steps to convert 1NF to 2 NF.
1. Write Each key component on separate line
A. PROJ_NUM
B. EMP_NUM
C. PROJ_NUM EMP_NUM
Here each component will become the key in a
new table so original table will be divided in to
three tables
PROJECT,
EMPLOYEE,
ASSIGNMENT
Conversion to 2NF CONTD.
2. Assign corresponding dependent attributes
PROJECT(PROJ_NUM,PROJ_NAME)
EMPLOYEE(EMP_NUM,EMP_NAME,JOB_CLASS,CHG_HOURS)
ASSIGNMENT(PROJ_NUM,EMP_NUM,ASSING_HOURS)
Characteristics of 2NF
1. Table must be in 1 Normal Form
2. it includes no partial dependency; that is no
attribute is dependent on only one portion of
primary key.
1. PROJECT(PROJ_NUM,PROJ_NAME)
2. EMPLOYEE(EMP_NUM,EMP_NAME,JOB_CLASS)
3. JOB(JOB_CLASS,CHG_HOUR).
4. ASSINGMENT(PROJ_NUM,EMP_NUM,ASSIGN_HOURS)
Characteristics of 3NF
• It is in 2NF.
• In contain no transitive dependencies.