Unit 3 Relational Database Design Answers
Unit 3 Relational Database Design Answers
Complete Answers
Q1. Define Functional Dependency with example. (4 Marks)
A Functional Dependency (FD) is a relationship between attributes in a relation such that
the value of one attribute (or a set of attributes) determines the value of another attribute.
Notation: A → B
This means: If we know A, we can determine B.
Example:
In a student table:
| RollNo | Name |
|--------|-------|
| 101 | Amit |
Here, RollNo → Name is a functional dependency because RollNo determines the Name of
the student.
Use:
- To check whether a given attribute is a candidate key
- To find all attributes that can be determined from a set of keys
- Useful in normalization and decomposition
Example:
If FDs are:
-A→B
-B→C
Then: A+ = {A, B, C}
Importance:
- Helps to maintain data integrity
- Guides the normalization process
- Avoids data redundancy and anomalies
Example:
If in an EMPLOYEE table, EmpID → EmpName, it means EmpName depends on EmpID. No
two employees can have the same ID with different names.
Q4. Explain how to find the closure of a set of attributes with example. (6
Marks)
To find the closure A+ of an attribute set A:
1. Start with A+ = A
2. Apply FDs repeatedly where left side is in A+
3. Add resulting attributes to A+
4. Repeat until no more attributes can be added
Example:
FDs:
-A→B
-B→C
Then A+ = {A, B, C}
Types:
- 1NF (First Normal Form)
- 2NF (Second Normal Form)
- 3NF (Third Normal Form)
- BCNF (Boyce-Codd Normal Form)
Example:
| Student | Subjects |
|---------|----------|
| Raj | Math, English | (Not in 1NF)
Fixed:
| Student | Subject |
|---------|---------|
| Raj | Math |
| Raj | English |
Example:
If PK = (RollNo, Subject), and RollNo → Name, it's partial dependency.
Fixed:
| Student | Subject |
|---------|---------|
| Raj | Math |
| Raj | Science |
Rule:
For every FD A → B, A must be a super key.
Difference:
- 3NF allows some non-super key dependencies if the RHS is a prime attribute.
- BCNF does not allow any non-super key determinant.
Example:
Relation:
| Course | Teacher |
|--------|---------|
| DBMS | Raj |
| DBMS | Neha |
FD: Teacher → Course, but Teacher is not a key. → Violates BCNF but may satisfy 3NF.
It is used when:
- Performance is more important than storage.
- Frequent JOINs slow down queries.
Q11. Explain the process of Denormalization. List its benefits and drawbacks
with example. (6 Marks)
Denormalization Process:
- Identify frequently joined tables.
- Merge them into one table.
- Add redundant columns to improve performance.
Benefits:
- Improves read performance
- Reduces JOIN operations
- Better for analytics and reports
Drawbacks:
- Increases redundancy
- Risk of data inconsistency
- More storage required
Example:
Instead of two tables:
Student Table: | RollNo | Name | DeptID |
Department Table: | DeptID | DeptName |