0% found this document useful (0 votes)
44 views3 pages

Indian Statistical Institute: PGDBA, First Year, Final of First Semester Examination, 2019-20

[1] The natural join of a table to itself will return the Cartesian product if the table contains duplicate tuples or no primary key. The given SQL queries find (i) cities with minimum air quality index below 300 and (ii) cities with maximum recorded low air quality index. [2] The two logical plans for the given SQL query are equivalent as plan 2 pushes the selection down. Plan 1 is likely more efficient with fewer tuples. The maximum size of a semi-join between two relations is the size of the larger relation. [3] The given medical appointments table is susceptible to insertion, deletion and modification anomalies due to lack of a primary key. Lossless-join and dependency preservation for a

Uploaded by

thecoolguy96
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)
44 views3 pages

Indian Statistical Institute: PGDBA, First Year, Final of First Semester Examination, 2019-20

[1] The natural join of a table to itself will return the Cartesian product if the table contains duplicate tuples or no primary key. The given SQL queries find (i) cities with minimum air quality index below 300 and (ii) cities with maximum recorded low air quality index. [2] The two logical plans for the given SQL query are equivalent as plan 2 pushes the selection down. Plan 1 is likely more efficient with fewer tuples. The maximum size of a semi-join between two relations is the size of the larger relation. [3] The given medical appointments table is susceptible to insertion, deletion and modification anomalies due to lack of a primary key. Lossless-join and dependency preservation for a

Uploaded by

thecoolguy96
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/ 3

Indian Statistical Institute

PGDBA, First Year, Final of First Semester Examination, 2019-20


Fundamentals of Database Systems

Full Marks: 50 Date: 11-12-2019 Time: 2 Hours


Answer any five of the following questions

5 × 10 = 50

1. (a) What will be returned as a result of natural join of a table to itself in case of the
following scenarios? Justify your answers.
(i) The table has a primary key.
(ii) The table has duplicate tuples but non-null entries.
(b) Consider the following schema. It represents the record low and record high AQI
(standing for air quality index) values calculated for different major cities across the
world over the last few decades.

AQI = <cid : integer; cname : string; recordlow : real; recordhigh : real; year : integer>

The primary key is underlined in the above schema. What will be returned by the
following SQL queries? Justify your answer.
(i) select cname from AQI group by cid having min(recordhigh) <= 300;
(ii) select A1.cname from AQI as A1, (select max(recordlow) as REC_LOW from
AQI) as A2 where A1.recordlow = A2.REC_LOW;
4+(3+3)
2. (a) Consider the relations R1(A, B), R2(B, C), and the following SQL query.

select R1.A from R1, R2 where R1.B = R2.B and R2.C = 0;

(i) Are the following two logical plans in relational algebra equivalent based on the
aforementioned schemas?

Plan 1: πA(σC=0(R1 B=B (R2)))


Plan 2: πA(R1 B=B (σC=0(R2)))

(ii) If not equivalent, justify why. If so, indicate and justify which one is likely to be
more efficient than the other.
(b) Consider a pair of relations R1 and R2, with t1 and t2 number of tuples, respectively. The
primary key of R1 is the only foreign key of R2. Estimate the maximum size of the
following query that includes a semi-join operation.
R1 ⋉ R2
(1+4)+5

1
3. (a) Consider the following table, with no primary key, representing the appointment
details of patients for surgeries in a hospital.

SID Surgeon PID Patient AppDate AppTime SurgeryNo


S01 Korth P01 NF1 22-10-2019 11:00 S07
S01 Korth P02 NF2 23-10-2019 13:00 S13
S02 Date P03 NF3 22-11-2019 11:00 S07
S02 Date P03 NF3 24-11-2019 11:00 S07
S03 Navathe P02 NF2 24-12-2019 15:30 S13
S03 Navathe P04 NF4 25-12-2019 17:00 S11

The above table is susceptible to update anomalies. Provide examples of insertion,


deletion, and modification anomalies based on this.
(b) Consider a relation R = (X, Y, Z), having the key X, and the set of functional
dependencies = {X → Y, Y → Z, X → Z}. Is the decomposition of R into (X, Y) and (X,
Z) lossless-join and dependency preserving? Justify your answer.
6+4
4. (a) Let there be a relation with data items X and Y. Derive the precedence graph from the
following schedule of transactions working on the said relation. Conclude whether
the given schedule is conflict serializable or not.

Transaction T1 Transaction T2
read(X)
X ← X – 10
write(X)
read(X)
T ← X * 0.05
X←X–T
write(X)
read(Y)
Y ← Y + 10
write(Y)
commit
read(Y)
Y←Y+T
write(Y)
commit

(b) Recall the concurrency control protocol based on multiple granularity of the database in
which the following locking models are considered.
 IS - Intention-shared lock
 IX - Intention-exclusive lock
 S - Shared lock as used conventionally
 SIX - Shared and intention-exclusive lock
 X - Exclusive lock as used conventionally

2
Identify the inaccurate entries in the following lock compatibility table.

IS IX S SIX X
IS True True True True True
IX True True True True False
S True True True False False
SIX True True False False False
X True False False False False
7+3
5. Consider the following collection of documents, in JSON format and created in NoSQL
environment within MongoDB, named as PROJECT.
{
"FName" : "Debapriyo Majumdar",
"Subject" : "Computing for Data Sciences",
"Presentations" : [
{
"Date" : "25-11-2019"
},
{
"Date" : "12-12-2019"
}
]
}
{
"FName" : "Malay Bhattacharyya",
"Subject" : "Fundamentals of Database Systems",
"Presentations" : [
{
"Date" : "14-12-2019"
}
]
}
{
"FName" : "Debasis Sengupta",
"Subject" : "Stochastic Processes & Applications"
}
What will the following queries return? Justify your answer.
(i) db.PROJECT.find({ $and : [{ "FName" : { $regex : /^D.ba/ } }, { "FName" : { $regex :
/R$/i } } ] });
(ii) db.PROJECT.find( { "Presentations.Date" : { $ne : "12-12-2019" } } );
5+5
6. Cite appropriate examples that satisfy the following requirements with proper justifications.
(i) A pair of relations with non-null entries on which left outer join and Cartesian product
will return the same result.
(ii) Uncommitted dependency between a pair of transactions.
5+5

You might also like