Professional Documents
Culture Documents
1 Albert Singh
2 Nora Fatehi
ROLLNO AGE
5 18
9 21
On applying
CROSS PRODUCT on STUDENT and DETAIL:
STUDENT ✕ DETAILS
SNO FNAME LNAME ROLL NO AGE
1 Albert Singh 5 18
1 Albert Singh 9 21
2 Nora Fatehi 5 18
2 Nora Fatehi 9 21
Join
operation(Inner and Outer join) is essentially a cartesian product followed
by a selection criterion.Join operation denoted by Select Operation
KIIT-DU/2023/SOT/Spring End Semester Examination-2023
JOIN operation also allows joining variously related tuples from different
relations.
In an inner join, only those tuples that satisfy the matching criteria are
included, while the rest are excluded.In an outer join, along with tuples
that satisfy the matching criteria, we also include some or all tuples that do
not match the criteria.
(b) What do you mean by inconsistent database? Discuss with suitable example. .5 +.5
Ans Consider the following transaction T consisting of T1 and T2: Transfer of
100 from account X to account Y.
1. SELECT *
2. FROM Student
3. WHERE gender = 'M' AND
4. marks > 65;
4 James M 82
Note: The query will return only a single row as both the select criteria are
satisified for 4th row where rollNum is 4
(f) Write the ACID properties of transaction with citing one example of ‘I’ .5 +.5
property.
Ans
Suppose T has been executed till Read (Y) and then T’’ starts. As a
result,interleaving of operations takes place due to which T’’ reads the
correct value of X but the incorrect value of Y and sum computed by
KIIT-DU/2023/SOT/Spring End Semester Examination-2023
T’’: (X+Y = 50, 000+500=50, 500)
is thus not consistent with the sum at end of the transaction:
T: (X+Y = 50, 000 + 450 = 50, 450).
This results in database inconsistency, due to a loss of 50 units. Hence,
transactions must take place in isolation and changes should be visible only
after they have been made to the main memory.
(j) How many minimum internal nodes are required for 1000 leaf nodes of B+ 1
tree with order P:8. (Assume Order P: maximum pointer per node.)
Ans Leaf level i.e. Level 4 has 1000, Level 3 has (1000/8)= 125 nodes, Level 2
has ceiling(125/8) = 16 nodes, Level 1 has (16/8)=2 nodes and level 0 has
KIIT-DU/2023/SOT/Spring End Semester Examination-2023
ceiling(2/8) = 1 node
SECTION-B (Learning levels 1,2, and 3)
2. (a) Why concurrency control is needed? Explain lost update, dirty read 2+2
and incorrect summary problem with suitable example.
Ans Concurrency control is an essential aspect of database
management systems (DBMS) that ensures transactions can
execute concurrently without interfering with each other. In a
multi-user system, multiple users can access and use the same
database at one time, which is known as the concurrent execution of
the database. It means that the same database is executed
simultaneously on a multi-user system by different users.
Concurrency Control is the working concept that is required for
controlling and managing the concurrent execution of database
operations and thus avoiding the inconsistencies in the database.
Thus, for maintaining the concurrency of the database, we have the
concurrency control protocols. The concurrency control protocols
ensure the atomicity, consistency, isolation,
durability and serializability of the concurrent execution of the
database transactions. Therefore, these protocols are categorized as:
(i) Lock Based Concurrency Control Protocol, (ii) Time Stamp
Concurrency Control Protocol, and (iii) Validation Based
Concurrency Control Protocol
When multiple transactions execute concurrently in an uncontrolled
or unrestricted manner, then it might lead to several problems.
Temporary Update Problem or Dirty Read Problem
Incorrect Summary Problem
Lost Update Problem
Unrepeatable Read Problem
Phantom Read Problem
Temporary update or dirty read problem occurs when one
transaction updates an item and fails. But the updated item is used
by another transaction before the item is changed or reverted back
to its last value.
T1 T2
Read(X)
X=X++
Write(X)
Read(X)
X=X++
Write(X)
Read(Y)
Example: Change in
compression techniques, Example: Add/Modify or
Hashing algorithms and Delete a new attribute.
storage devices etc.
(b) Given the following schemas, give the relational algebra and 2+2
domain relational calculus expression for the queries.
employee (person_name, street, city)
works (person_name, company_name, salary)
company (company_name, city)
(i) Find the names of all employees whose salary is greater than
100000.
(ii) Find the names of all employees who is from Mumbai and
works in Delhi.
Ans
(b) What is 4NF? Give an example of a relation schema R and a set of 1+3
dependencies such that R is in BCNF, but not in 4NF.
Ans
5. (a) Find the canonical cover of the following FDs on R(VWXYZ) [4]
FD: V→W, VW→X, Y→VWX
Ans Step 1 -> Separate all right hand side value so that it become
atomic.
4. Y+ ={YVWX}
Y+ ={YVXW}
Step-2 -> Check for each of the value LHS using closure from FD’s
(one time including it other time ignoring it).
If match means it is redundant.
Final(Combine)
V -> WX
Y-> V We can get the desire value of VW from VW
from V only then there is no need of w , so remove it . .
(b) Which normal form is considered adequate for normal database 1+3
design ? Consider a relation with set of functional dependencies
(FD) as R(ABCDEF).
FD= AB->CDEF, C->A, D->B, C->D, E->F and B->E.
What is the normal form of the relation ?
3NF is sufficient because because most of the 3NF tables are free of
insertion, update, and deletion anomalies. Moreover, 3NF always
ensures functional dependency preserving and lossless.
R(ABCDEF)
So we can say that the highest normal form of above FD’s is 1NF
only.
Ans Evaluation Scheme: Full mark for the correct answer. Stepwise
mark may be awarded based on the partial correctness of the
solution. 2 marks for part A and rest 2 marks for part B.
Solution:
A) Step 1: Create node for each transaction.
T1 T2 T3 T4
Read(X)
Write(X)
Write(Y)
Read(Y)
Read(X)
Read(Y)
(b) Map the ERD in above question to create the relational model. [4]
(Indicate primary keys as well as referential integrity constraint).
Ans Team=(ID, name, city, stadium_name)
Team=(ID, name, city, stadium_name)
Match=(ID,date, final result, player participated)
Player=(number, dob, player name, age, shirtnum, startyear)
Role=(ID,date)
Bowler end umpire=( ID, name, year of experience, dob) Contact
no=(ID,cont_no)
Square leg umpire=( ID, name, year of experience, dob)
Third umpire=( ID, name, year of experience, dob)
Match player= (ID, run score, wicket time)
8. (a) Create a B+ tree of order 3, with the following data: 13, 2, 5, 63, [2]
23, 11,74
Ans
Ans
*****