1.introduction To Schema Refinement: Problems Caused by Redundancy
1.introduction To Schema Refinement: Problems Caused by Redundancy
Slide No:L1-2
• Consider a relation obtained by translating a variant of the
Hourly Emps entity set
XY
3.Decompositions
• Intuitively, redundancy arises when a relational schema forces an
association between attributes that is not natural.
Slide No:L1-4
• We can deal with the redundancy in Hourly Emps by decomposing it into two relations:
1.Table _Wages
8 10
5 7
Slide No:L1-5
2.Table Hourly Emps
123-22-3666
Attishoo 48 8 40
231-31-5368
Smiley 22 8 30
131-24-3650 Smethurst
35 5 30
434-26-3751 Guldu
35 5 32
612-67-4134 Madayan
35 8 40
Slide No:L1-6
2.1.Problems Related to Decomposition
Employee(eno,ename,salary,rating,did,since);
With this relation the given FDs are
• The normal forms based on FDs are first normal form (1NF), second normal form
(2NF), third normal form (3NF), and Boyce-Codd normal form (BCNF).
• A relation is in first normal form if every field contains only atomic values, that is,
not lists or sets.
• This requirement is implicit in our defination of the relational model.
• Although some of the newer database systems are relaxing this requirement 2NF
is mainly of historical interest. 3NF and BCNF are important from a database design
standpoint.
Slide No:L3-1
4.1First Normal Form
The relation employee is in 1NF since the column dependents have atomic value
But the other attributes i.e. emp_id, emp_section_id, emp_name, emp_address
are all repeating and forming a group called repeated groups.
emp & emp_dependents tables
Emp_id Emp_section_id Emp_name Emp_address S.No Emp_id dependents
5 0013 Mother
6 0013 Son
7 0014 Brother
8 0014 Sister
9 0015 Sister
10 0015 Mother
• Student(student_id,class_id,name,cource,time)
• (student_id,class_id,)is the primary key,
• In particular, the 1 2 3
4 5 6
decomposition of R into 7 2 8
UV and
R - V is lossless-join 1 2 8
if U V holds over R. 7 2 3
Slide No. L4-5
Dependency Preserving Decomposition
Slide No:L5-3
Identifying Entity Sets
• Let Reserves contain attributes S, B, and D as before, indicating that sailor
S has a reservation for boat B on day D.
• In addition, let there be an attribute C denoting the credit card to which
the reservation is charged.
• Suppose that every sailor uses a unique credit card for reservations. This
constraint is expressed by the FD
S -> C. This constraint indicates that in relation Reserves, we store the credit
card number for a sailor as often as we have reservations for that sailor,
and we have redundancy and potential update anomalies.
• Solution is decompose the relation into two relations with attributes SBD
(holds info about reservation) and SC(holds credit cards info)
• Think about ER design that would lead to these relations :
• One approach is to introduce an entity set called Credit_Cards, with the
sole attribute cardno and a relationship set called Has_Card associating
Sailors and Credit_Cards. We would not probably model credit card
number as entity if our main interest in card numbers is to indicate how a
reservation is to be paid for;
Slide No:L5-4
Identifying Entity Sets
• A second approach is to make cardno an
attribute of Sailor. But this approach is not
very natural-a sailor may have several cards,
and we are not interested in all of them.
• Our interest is in the one card that is used to
pay for reservations.
• Best modeled as an attribute of the
relationship reserves.
Multi Valued Dependencies
• Suppose that we have a relation with attributes course ,teacher and book,
which we denote as CTB. The meaning of a tuple is that teacher T can
teach course C, and book B is recommended text for the course.
• There are no FD’s; the key is CTB. However recommended text s for a
course are independent of the instructor.
Multi Valued Dependencies
Slide No:L6-2
• Three of the additional rules involve only MVDs:
• MVD Complementation: If X →→Y, then X →→ R − XY
• MVD Augmentation: If X →→ Y and W > Z, then
WX →→ YZ.
• MVD Transitivity: If X →→ Y and Y →→ Z, then
X →→ (Z − Y ).
Slide No:L6-4
Fourth Normal Form
Slide No:L7-1
Fifth Normal Form
• A relation schema R is said to be in fth normal form (5NF) if
for every JD ∞{ R1,…. Rn } that holds over R, one of the
following statements is true:
• Ri = R for some i, or
• The JD is implied by the set of those FDs over R in which the
left side is a key for R.
• The following result, also due to Date and Fagin, identies
conditions|again, detected using only FD information|under
which we can safely ignore JD information.
• If a relation schema is in 3NF and each of its keys consists of a
single attribute,it is also in 5NF.
Slide No:L7-2
Inclusion Dependencies
• MVDs and JDs can be used to guide database design, as we
have seen, although they are less common than FDs and harder
to recognize and reason about.
Slide No:L7-3