Module-3 DBMS CS208 Notes
Module-3 DBMS CS208 Notes
GUIDELINE 3: Relations should be designed such that their tuples will have as few NULL values as possible
- Attributes that are NULL frequently could be placed in separate relations (with the primary key)
KTU STUDENTS
- Reasons for nulls:
- Bad designs for a relational database may result in erroneous results for certain JOIN operations
- The "lossless join" property is used to guarantee meaningful results for join operations
GUIDELINE 4: The relations should be designed to satisfy the lossless join condition. No spurious tuples should be generated by doing a
natural-join of any relations.
Functional Dependencies
- Functional dependencies (FDs) are used to specify formal measures of the "goodness" of relational designs
- FDs and keys are used to define normal forms for relations
- FDs are constraints that are derived from the meaning and interrelationships of the data attributes
- A set of attributes X functionally determines a set of attributes Y if the value of X determines a unique value for Y
X -> Y in R specifies a constraint on all relation instances r(R)
- For any two tuples t1 and t2 in any relation instance r(R):
If t1[X]=t2[X], then t1[Y]=t2[Y]
- X -> Y holds if whenever two tuples have the same value for X, they must have the same value for Y
- FDs are derived from the real-world constraints on the attributes
An FD is a property of the attributes in the schema R
- The constraint must hold on every relation instance r(R)
- If K is a key of R, then K functionally determines all attributes in R (since we never have two distinct tuples with t1[K]=t2[K])
www.ktustudents.in
KTU STUDENTS
Equivalence of Sets of FDs
- Two sets of FDs F and G are equivalent if: every FD in F can be inferred from G, and every FD in G can be
inferred from F. Hence, F and G are equivalent if F =G
+ +
+ +)
- Definition: F covers G if every FD in G can be inferred from F (i.e., if G subset-of F
- F and G are equivalent if F covers G and G covers F
- There is an algorithm for checking equivalence of sets of FDs
www.ktustudents.in
- Normal form: Condition using keys and FDs of a relation to certify whether a relation schema is in a
particular normal form
- 2NF, 3NF, BCNF based on keys and FDs of a relation schema
- 4NF based on keys, MVDs; 5NF based on keys,
-Additional properties may be needed to ensure a good relational design (lossless join, dependency
preservation;
KTU STUDENTS
FIRST NORMAL FORM
First normal form (1NF) is now considered to be part of the formal definition of a relation in the basic
(flat) relational model. It states that:
1. The domain of an attribute must include only atomic (simple, indivisible) values and
2. That the value of any attribute in a tuple must be a single value from the domain of that attribute.
Hence, 1NF disallows having a set of values, a tuple of values, or a combination of both as an attribute
value for a single tuple. In other words, 1NF disallows relations within relations or relations as attribute
values within tuples. The only attribute values permitted by 1NF are single atomic (or indivisible) values.
Consider the DEPARTMENT relation schema, whose primary key is Dnumber, and suppose that we
extend it by including the Dlocations attribute. Assuming each department can have a number of
locations. This is not in 1NF because Dlocations is not an atomic attribute
www.ktustudents.in
KTU STUDENTS
www.ktustudents.in