0% found this document useful (0 votes)
3 views

Assignments Unit 3

Uploaded by

Yash thakur
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Assignments Unit 3

Uploaded by

Yash thakur
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Department of Computer Science & Engineering

III B.Tech V Sem Section-A & B A.Y.2024-2025

SUBJECT: DBMS ASSIGNMENT-3 UNIT-3

1. Write different Inference Rule for Functional Dependency?

Inference Rules for Functional Dependencies


Functional dependencies (FDs) are constraints that specify how attributes in a relation are
related. Inference rules are used to derive new FDs from a given set of FDs. These rules are
crucial for database design and normalization.
Here are the primary inference rules for FDs, often referred to as Armstrong's Axioms:
1. Reflexivity:
o If Y is a subset of X, then X → Y.
o Example: If {A, B, C} is a set of attributes, then {A, B, C} → {A} and {A, B, C} → {B}.
2. Augmentation:
o If X → Y, then XZ → YZ for any set of attributes Z.
o Example: If A → B, then AC → BC.
3. Transitivity:
o If X → Y and Y → Z, then X → Z.
o Example: If A → B and B → C, then A → C.
In addition to these core axioms, there are derived rules that can be useful:
4. Union:
o If X → Y and X → Z, then X → YZ.
o Example: If A → B and A → C, then A → BC.
5. Decomposition:
o If X → YZ, then X → Y and X → Z.
o Example: If A → BC, then A → B and A → C.
6. Pseudotransitivity:
o If X → Y and YZ → W, then XZ → W.
o Example: If A → B and BC → D, then AC → D.

2. Explain MVD with the help of suitable example.

Multivalued Dependency (MVD)


A multivalued dependency (MVD) is a type of dependency that exists between attributes of
a relation. It occurs when two or more independent multivalued attributes are associated
with a single primary key.
Example:
Consider a relation STUDENT with attributes:
 SID (Student ID)
 COURSE (Course Enrolled)
 TEXTBOOK (Textbook Used)

3. What is highest normal form of the Relation R(W,X,Y,Z) with the set F= { WY → XZ, X →Y }

Determining the Highest Normal Form


To determine the highest normal form of the relation R(W,X,Y,Z) with the given functional
dependencies F = {WY → XZ, X → Y}, we need to analyze the relation according to the normal
form definitions.
1. First Normal Form (1NF):
 All attributes must be atomic.
 Assuming all attributes are atomic, R is in 1NF.
2. Second Normal Form (2NF):
 R must be in 1NF.
 Every non-prime attribute must fully depend on a candidate key.
o Candidate keys: {WY, X}
o Non-prime attributes: {Z}
o Z fully depends on WY but not on X.
 Therefore, R is not in 2NF.
Conclusion:
Since R fails to meet the conditions of 2NF, it cannot be in any higher normal form (3NF,
BCNF, or 4NF).
Highest Normal Form:
1NF

4. Consider a relation R(A,B,C,D,E) with set F= { A→CD,C→B,B→AE} What are the prime
attributes of this Relation and Decompose the given relation in 3NF.

Prime Attributes:
To find the prime attributes, we need to identify the candidate keys. A candidate key is a
minimal set of attributes that uniquely identifies a tuple in the relation.
From the given functional dependencies:
 A is a candidate key because it determines all other attributes: A → CD, and then C → B, and
B → AE.
Therefore, A is the only prime attribute in this relation.
Decomposition into 3NF:
To decompose the relation into 3NF, we need to eliminate partial dependencies and
transitive dependencies.
Step 1: Identify Violations of 2NF:
 A → CD: This is a partial dependency because CD doesn't fully depend on the whole key A.
Step 2: Decompose the Relation: To eliminate the partial dependency, we can decompose
R into two relations:
1. R1(A, C, D): This relation satisfies 3NF because A is the primary key and determines both C
and D.
2. R2(C, B, E): This relation also satisfies 3NF because C is the primary key and determines B
and E.
Final Decomposition:
 R1(A, C, D)
 R2(C, B, E)
This decomposition is lossless and dependency-preserving, ensuring that no information is
lost and all functional dependencies are preserved.

5. Explain the Below


(i) Loss Less Decomposition with example.
(ii) 2NF,3NF and BCNF with short note

Lossless Decomposition
A decomposition of a relation R into relations R1, R2, ..., Rn is lossless if the natural join
of R1, R2, ..., Rn yields the original relation R. This means that no information is lost
during the decomposition process.
Example:
Consider a relation R(A, B, C) with the functional dependency A -> BC. We can
decompose R into two relations:
1. R1(A, B)
2. R2(A, C)
This decomposition is lossless because the natural join of R1 and R2 will give us the
original relation R.
2NF, 3NF, and BCNF
2NF (Second Normal Form):
 Every non-prime attribute must fully depend on the whole primary key.
 A relation is in 2NF if it is in 1NF and no non-prime attribute is partially dependent on the
primary key.
3NF (Third Normal Form):
 A relation is in 3NF if it is in 2NF and no non-prime attribute transitively depends on the
primary key.
BCNF (Boyce-Codd Normal Form):
 A relation is in BCNF if every determinant is a candidate key.
Note:
 BCNF is a stronger normal form than 3NF.
 Every BCNF relation is also in 3NF, but not every 3NF relation is in BCNF.
 The goal of normalization is to reduce redundancy and anomalies in a database. By
normalizing a relation to a higher normal form, we can improve its data integrity and query
performance.

You might also like