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

3.relational Database Design

The document provides information about database normalization from 1NF to BCNF. It includes: 1) Definitions of 1NF, 2NF, 3NF and BCNF and examples to explain each normal form. 2) An example of normalizing a relation from 1NF to 4NF through decomposition. 3) Explanations of concepts like functional dependencies, canonical cover, closure of attribute sets, and lossless decomposition, with examples. The document serves as a reference for students to understand database normalization techniques and apply them to decompose relations and eliminate anomalies through multi-table normalization.

Uploaded by

BHAVESH
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
94 views

3.relational Database Design

The document provides information about database normalization from 1NF to BCNF. It includes: 1) Definitions of 1NF, 2NF, 3NF and BCNF and examples to explain each normal form. 2) An example of normalizing a relation from 1NF to 4NF through decomposition. 3) Explanations of concepts like functional dependencies, canonical cover, closure of attribute sets, and lossless decomposition, with examples. The document serves as a reference for students to understand database normalization techniques and apply them to decompose relations and eliminate anomalies through multi-table normalization.

Uploaded by

BHAVESH
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

1

L .J. INSTITUTE OF ENGINEERING & TECHNOLOGY


GTU B.E. SEM – III (Computer Engineering)
Sub: - Database Management System (2130703)
Question Bank with Solution(Year – 2016)
Unit 4: 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

Anomalies in the database can be solved by normalization process.


2. Explain BCNF with example[LJIET]Dec 2009 Dec 2013 4
OR
Explain BCNF with example[LJIET]Dec 2011 May 2013
OR
Explain BCNF with example.[LJIET]May 2011

3NF is not strong to handle following cases-


1) Relation has two or more candidate keys
2) The candidate keys are composite
3) They are overlapped (they have at least one attribute in common)

 A relation is in BCNF if and only if every determinant is a candidate key.

 E.g. Supplier(S_No, S_Name,Part_No,Quantity)


Prepared By: - Prof. Munira Topia, Computer Engineering Department, L. J. Institute of Engineering & Technology, Ahmedabad
3

S_No S_Name Part_No Quantity


S1 Sarola P1 300
S1 Sarola P2 200
S1 Sarola P3 400
S1 Sarola P4 200

 The candidate key’s are


1) { S_no, Part_number}
2) {S_Name, Part_number}

 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}

3. Explain how to find closure of a set of attributes?[LJIET]Dec 2009 3

Closure of Attribute Sets

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:

if + = R, then  is a superkey for R

if we find + for all  R, we've computed F

An algorithm for computing +:

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 AB)
3. result = ABCGH (CGH and CGAGBC)
4. result = ABCGHI (CGI and CGAGBCH)
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

• Decomposition in database means breaking tables down into multiple tables


• From Database perspective means going to a higher normal form
• Two Characteristics of Good Decompositions
1) Lossless
2) Preserve dependencies
• Lossless means functioning without a loss.
• Let R be a relation schema.Let F be a set of functional dependencies on R.
• The decomposition is a lossless-join decomposition of R if at least one of the following functional
dependencies are in F+
1) R1 ∩ R2  R1
2) R1 ∩ R2  R2
If R is split into R1 and R2, for the decomposition to be lossless then at least one of the two should hold
true this ensures that attributes involved in the natural join (R1 ∩ R2) are a candidate key for at least one
of the two relations.
A decomposition is lossless if we can recover:

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

9. Explain 1NF, 2NF, 3NF and BCNF[LJIET]Dec 2010 7


OR
What is normalization? Explain 1NF, 2NF & 3NF.[LJIET] May 2012
OR
What is normalization? Why normalization process is needed? Explain 1 NF, 2 NF and 3 NF with
example. [LJIET]May 2014
OR
Explain with suitable example, the process of normalization covering from 1NF to 3NF.[LJIET] Nov
2013
OR
Explain 2NF with example[LJIET]May 2013 (write only 2NF from following answer)
OR
What is normalization? What is redundancy? Compare 1NF and 2NF with example. [LJIET]Dec 2011

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

: A B, BCE and EDA a)List all Keys for R


b) In which normal form table is, justify your answer.[LJIET]Dec 2010
OR
Consider table R(A,B,C,D,E) with FDs as A->B, BC->E and ED-> A. The table is in which normal form?
Justify your answer[LJIET]May 2013

Keys of R are: - {ACD} {BCD} {CDE}


Above relation is in 3NF because there is no nonprime attributes. That is every column is part of super key,
so right hand side of every FD must be a part of super key. But above relation is not in BCNF, 4NF or 5NF
11. Define functional dependency. Explain trivial and non-trivial FD with example. [LJIET]May 2011 3
OR
What is functional dependency? Explain its usage in database design.[LJIET]May 2013
OR
What is Functional Dependency? Explain.[LJIET]Dec 2014

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

Fourth Normal Form


When attributes in a relation have multivalued dependency, normalization to 4 NF is required.

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.

Vendor_code Item_code Project_no


V1 I1 P1
V1 I2 P1
V1 I1 P3
V1 I2 P3
V2 I2 P1

The above relation has insertion anomaly and redundancy.


- A Relation is in 4NF if it has no more than one independent multivalued dependency.
 The above relation will be decomposed to convert in 4NF

(a) Vendor supply (b) vendor Project


Vendor Item code
Vendor Item code code
code V1 P1
V1 I1 V1 P3
V1 I2 V2 P1
V2 I2 V3 P1
V2 I3 V3 P2
V3 I1

Above relations are in 4NF.

Fifth Normal Form

 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.

 For example consider relation.

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

Will decompose into three projections as

Dealer Ports Customer dealer


Part customer D1 P1 C1 D1
P1 C1 D1 P2 C2 D1
P1 C2 D2 P1 C1 D2
P2 C1 (DP) (CD)
(PC)

Join DP – PC

Dealer Port customer


D1 P1 C1
D1 P1 C2
D1 P2 C1
D2 P1 C1
D2 P1 C2

Again join DP – PC with CD

Dealer Ports customer


D1 P1 C1
D1 P2 C1
D1 P1 C2
D2 P1 C1

 Dealer_part_supplier is obtainable if all the three projections are joined

 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

You might also like