3.relational Database Design
3.relational Database Design
1. What are anomalies in database design? How can we solve it? [LJIET]Dec2009 Dec 2013 3
OR
What problems can occur due to wrong database design? How they can be solved? [LJIET]May 2011 Dec
2014
OR
Explain the issues of a database design.[LJIET] Jan 2013
Prepared By: - Prof. Munira Topia, Computer Engineering Department, L. J. Institute of Engineering & Technology, Ahmedabad
2
The above relation is not in BCNF because it contains two determinants S_No & S_name, which are not
candidate keys.
Above relation have database anomalies like insertion, deletion and updation.
The solution of above problem is to decompose the above relation to two relations as
SS = {S_no, S_name} and
Shipment = {S_no,Part_number,Quantity}
Given a set of attributes of R and a set of functional dependencies F, we need a way to find all of the attributes
of R that are functionally determined by . This set of attributes is called the closure of under F and is denoted
+. Finding + is useful because:
result :=
repeat
temp := result
for each functional dependency in F do
if result then
result := result
until temp = result
Example:
R = (A, B, C, G, H, I)
F = {A B,A C ,CG H,CG I,B H}
(AG) +
1. result = AG
2. result = ABCG (A C and AB)
3. result = ABCGH (CGH and CGAGBC)
4. result = ABCGHI (CGI and CGAGBCH)
4. What is normalization? What is the need for normalization?[LJIET]Dec 2009 Dec 2014 4
Prepared By: - Prof. Munira Topia, Computer Engineering Department, L. J. Institute of Engineering & Technology, Ahmedabad
4
Normalization:
Database Normalization is a technique of organizing the data in the database. Normalization is a systematic
approach of decomposing tables to eliminate data redundancy and undesirable characteristics like Insertion,
Update and Deletion Anomalies. It is a multi-step process that puts data into tabular form by removing
duplicated data from the relation tables.
Need for Normalization:
Minimize redundancy in data
Remove insert, delete and update anomaly during database activities
Reduce the need to reorganize data when it is modified or enhanced.
Normalization reduces a complex user view to set a small and stable subgroup of fields/relations.
This process helps to design a logical data model known as conceptual data model.
5. Explain 3NF with example[LJIET]Dec 2009 3
OR
Explain 3NF with example.[LJIET]May 2011
OR
What is the advantage of using 3NF? Explain with example[LJIET]Dec 2011
As explained in question no 10.
6. What is non-loss decomposition in database? How it is useful in database? [LJIET]Dec 2009 Dec2013 3
OR
What is decomposition? Why is it required? Explain the difference between lossy decomposition and non-
loss decomposition with example [LJIET]May 2014
OR
What is Functional Dependency? Explain non-loss decomposition.[LJIET] May 2012
Prepared By: - Prof. Munira Topia, Computer Engineering Department, L. J. Institute of Engineering & Technology, Ahmedabad
5
Decomposition is lossless if we can recover the same data back when join the two relations
7. Normalize (decompose) following relation into lower to higher normal form.(From 1NF to 4NF) 8
[LJIET] Mar 2010
Prepared By: - Prof. Munira Topia, Computer Engineering Department, L. J. Institute of Engineering & Technology, Ahmedabad
6
Prepared By: - Prof. Munira Topia, Computer Engineering Department, L. J. Institute of Engineering & Technology, Ahmedabad
7
8. What is canonical cover? Consider following set F of functional dependencies on schema R(A,B,C) 6
and compute canonical cover for F. A -> BC B -> C A -> B AB -> C.[LJIET] Mar 2010
Prepared By: - Prof. Munira Topia, Computer Engineering Department, L. J. Institute of Engineering & Technology, Ahmedabad
8
Prepared By: - Prof. Munira Topia, Computer Engineering Department, L. J. Institute of Engineering & Technology, Ahmedabad
9
Normalization:
Database Normalization is a technique of organizing the data in the database. Normalization is a systematic
approach of decomposing tables to eliminate data redundancy and undesirable characteristics like Insertion,
Update and Deletion Anomalies. It is a multi-step process that puts data into tabular form by removing
duplicated data from the relation tables
Need for Normalization: -
- To eliminate redundant data
- To Reduce chances of errors
- To eliminate data anomalies
- To improve data integrity and consistency
Prepared By: - Prof. Munira Topia, Computer Engineering Department, L. J. Institute of Engineering & Technology, Ahmedabad
10
Prepared By: - Prof. Munira Topia, Computer Engineering Department, L. J. Institute of Engineering & Technology, Ahmedabad
11
10. Consider a relation R with five attribute A,B,C,D,E having following dependencies 7
Prepared By: - Prof. Munira Topia, Computer Engineering Department, L. J. Institute of Engineering & Technology, Ahmedabad
12
Prepared By: - Prof. Munira Topia, Computer Engineering Department, L. J. Institute of Engineering & Technology, Ahmedabad
13
12. Given relation R with attributes A,B, C,D,E,F and set of FDs as A-> BC, E-> CF, B->E and CD-> EF. 3
Find out closure {A, B} + of the set of attributes. [LJIET]May 2011
13. Explain irreducible sets of Functional dependency with example.[LJIET] May 2012 3
A functional dependency set S is irreducible if the set has three following properties:
1) Each right set of functional dependency of S contains only one attribute.
2) The left side of a functional dependency of S is irreducible means that no attribute can be discarded
from the determinant without changing the closure S+
3) No functional dependency in S can be discarded from S without changing the closure S+
For every set of functional dependencies’ there exists at least one equivalent set that is irreducible.
7
14. Why do we need normalization? Explain 4NF & 5NF. [LJIET] May 2012
Prepared By: - Prof. Munira Topia, Computer Engineering Department, L. J. Institute of Engineering & Technology, Ahmedabad
14
OR
What are Multi-valued dependencies? Explain with an appropriate example
Multivalued Dependency – Consider three fields X, Y and Z in a relation. If for each value of X there is
well-defined set of values of values of Y and well defined set of values of Z and set of values of Yare
independent of the set of values of Z then multivalued dependency exist.
X Y/Z
Example –
1) A vendor is capable of supplying many items.
2) A Project user many items.
3) A vendor supplies to many Projects.
4) An item maybe supplied by many vendors.
There are some relations which cannot be decomposed into two projections but these relations can be
decomposed into three projections, is called 5NF.
We need to convert the relation into 5NF when join dependency exist in a relation.
A relation which has a join dependency cannot be decomposed by projections into other relations
without any difficulty & undesirable results.
Prepared By: - Prof. Munira Topia, Computer Engineering Department, L. J. Institute of Engineering & Technology, Ahmedabad
15
Dealer_parts_customer (DPC)
Dealer Pores customer
D1 P1 C1
D1 P1 C2
D1 P2 C1
D2 P2 C1
D2 P1 C1
Join DP – PC
Two projections if joined do not give back the original dealer_part_customer relations. This is called join
dependency.
15. Why should normalization be performed on a table and what are its benefits. Explain 3NF and 7
BCNF. [LJIET] Jan 2013
Ans: - Explain need for normalization, 3NF and BCNF which are explained in different parts in this solution
Prepared By: - Prof. Munira Topia, Computer Engineering Department, L. J. Institute of Engineering & Technology, Ahmedabad