Professional Documents
Culture Documents
Eabs Rdbms Normf Aug10 v0.2
Eabs Rdbms Normf Aug10 v0.2
RDBMS
26 Aug 2010
Zarir J Daruwalla
zarirdaru@hotmail.com
Version 0.1
Agenda
• Relation
• Functional Dependency
• Normalization
– 1NF, 2NF, 3NF, BCNF
• Other Normal Form
• Synthesis of Relations
• De-Normalization
• Controlled Redundancy
12/07/21 2
Relation
12/07/21 3
Functional Dependency
• E.g.
– Emp No Emp Name
– City Country
– Building Plot number,
– Emp No (Emp Name, City, Country)
12/07/21 4
Functional dependency (example)
12/07/21 5
Functional dependencies (Multiple attributes)
• Consider table
Student_Grade (Student ID, Course Name,
Grade)
(Student ID, Course Name) Grade
12/07/21 6
Functional dependencies (Keys and uniqueness)
12/07/21 7
Activity Entity
12/07/21 8
Relation Observations
SID Activity
• Problem is because Activity
Relation has two themes 100 Skiing
• Anomalies can be eliminated 150 Swimming
by redefining relation into two
or more relations 175 Squash
• One has to take care of 200 Swimming
Referential Integrity (While
Adding SID, check activity
record exists, while Deleting
Activity Fee
Activity, check Student record
does not exist) Skiing 200
Swimming 50
Squash 50
12/07/21 10
1 Normal Form (1NF)
12/07/21 11
1NF issues
Meena Accounting
Meena Performance
12/07/21 12
Second Normal Form (2NF)
Primary Key
Product_No Product_Description
RX234 Car Engine
Supplier_No Product_No
22532 RX234
12/07/21 14
Third Normal Form (3NF)
• No Transitive Dependency
– One need to separate those attributes in separate
relation.
• Supplier Name City and City State
12/07/21 15
Normalization to 3NF
City State
Mumbai MH
Supplier_Name City
Ramesh Mumbai
Paresh Mumbai
12/07/21 16
Boyce-CODD Normal Form (BCNF)
BCNF
• 3NF +
• Every determinant is candidate key.
(Determinant some attribute depends upon
the same)
12/07/21 17
BCNF
12/07/21 18
BCNF Anomalies
12/07/21 19
Recap of NF 1/2
1NF
• Eliminate repeating Groups. Attributes must have only
atomic values.
2NF
• Eliminate partial dependencies. All attributes must be
functionally dependent on the complete primary key.
3NF
• Eliminates transitive dependencies. All non-key domains
must be mutually exclusive.
12/07/21 20
Recap of NF 2/2
BCNF
• Eliminate functional dependencies in primary attributes in
the consequent. All determinants must be super-keys.
4NF
• Eliminate independent multi-valued attributes.
5NF
• Eliminate join dependencies. When-ever a non-loss
decomposition is possible, it must be carried out.
12/07/21 21
Synthesis of Relation
12/07/21 25
De-normalization Tips 2/2
12/07/21 26
Exercise Employee Information System
• Employee has a unique ‘Emp Code’. Employee also has ‘Last Name’
as other attribute, but it is not unique. Other attributes consist of
‘Birth Date’, ‘Hire Date’, and ‘Basic Salary’.
• Employee’s education is described in terms of various ‘Degrees’
(e.g. SSC, LLB, etc.) Employee can have multiple degrees. Some
employees may not have any degree.
• Employee works in one department. Every department has one
manager, who is also an employee.
• Employee is assigned one ‘Job Class’. Each ‘Job Class’ is described
in detail under ‘Title’.
• Employee might have one or more dependents. Dependent can be
spouse, child or parent.
• Employee might be given one or more ‘level’ of training (‘L1’, ‘L2’
etc.)
12/07/21 28
Quiz 2/6
12/07/21 29
Quiz 3/6
12/07/21 30
Quiz 4/6
12/07/21 31
Quiz 5/6
12/07/21 32
Quiz 6/6
12/07/21 33
Exercise ACID test related.
12/07/21 34
Questions
&
Thank-you
12/07/21 35