0% found this document useful (0 votes)
64 views6 pages

IT3020 - Database Systems

Uploaded by

jathurshanm3
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)
64 views6 pages

IT3020 - Database Systems

Uploaded by

jathurshanm3
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/ 6

/ 00750

Sri Lanka Institute of Information Technology

8. Sc. Honours Degree


in
Information Technology
Final Examination

Year 3, Semester I

IT3020 -Database Systems

Duration: 2 Hours

June 2022

Instructions to Candidates:
• This paper is preceded by a 10-minute reading period. The supervisor will
indicate when answering may commence.
• This paper contains 4 questions. Answer All Questions.
• Use the booklets given to provide answers.
• Total marks for the paper will be 100.
• A mark for each question is mentioned in the paper.
• This paper contains 6 pages with the Cover Pager.
• Electronic devices capable of storing and retrieving text, including calculators and
mobile phones are not allowed.
Question 1 25 marks

Consider the following object relational schema for a database of ABC Airline.

Object types:
Customer_t (cz.c7: char(7), 7zcz777e': varchar( 15), p¢o7?e: varchar( 10))
Schedule_t OZz.g7z/77o:char(6), c7epfz.#cc:char(6), so#rce: varchar(12), c7esfz.77czfz.o77: varchar( 12), capczcz.ty:
integer)
Booking_t @czsse7?gcr: ref customer_t, ticketno: cfoczr(10),/c}re: float)
Passenger_list table of booking_t
Flight_t 07z.g7zf: ref schedule_t, c7cpc7czfe : date, pczsse7?gers: passenger_list)

Table:
Customers of customer_t (cid primary key)
Schedules of schedule_t (flightno primary key)
Flights of flight_t (flight not null references schedule, depdate not null)
Nested table passengers store as passengerlist_ntab EE2

The customers table of customer_t has attributes of customer id (cz.®, #cz777c, and pfeo77e. It contains
tuples for all customers. Schedules table of schedule_t contains tuples for all scheduled flights, and
has the attributes flight number OZz.gfef77o), departure time at source (depfz.772e), so2trcc and c7eszz.#c7/I.oJ7 of
the flight, and seating capacity. The flights table of flight_t records the information of an actual flight
on a particular date and consists of attributes for flight reference, date of departure (c7apc7cz/c), and a
nested table of passenger details. The nested table contains passenger reference, ticket number
(fz.ckefroo), and the fare charged for the given flight. The attrib=Te types are specified in the type
descriptions above. The primary keys and referential constraints are shown in the table schema.
Note that date litera]s can be specified in SQL statements as `DD-MM~YY'

(a) Write oracle oR-SQL statements for the following queries (use columns of REF type instead of
joins to link tables).

(i) Find the cheapest flight from Colombo to London in 15th of october 2021.
(4 marks)

(ii) Find the total fare collected from passengers booked on each flight departing London for
Colombo on 25 December 2021. Display the flight number, and the total fare. -,
(5 marks)

(b) Add a new passenger to flight number `QRO9' departing on 25th of May, 2022. This passenger
exists in the customers table with cj.c7 of `AW35462'. The ticket number for this passenger is
`LAST10210' and the fare LKR85000.

(5 marks)

(c) It is required to add a member method calledpczsscoz4#r to calculate the number of passengers on
a flight. Write Oracle SQL statements to modify the object type flight_t by adding this method
specification.
(7 marks)

(d) Using the method defined above, write an Oracle SQL statement to display the
available seats on flights from Colombo to Singapore on lst of June 2022. The

Page 2 of 6
00750

available seats is the difference between the capacity of a flight and the current number of
passengers booked to travel. Display the flight number, departure time, and the number of
available seats.
(4 marks)

Question 2 (25 marks)

(a) Compare and contrast the heap and sequential file organization approaches.
(3 marks)
(b) Consider a employees relation containing records with employee id, name, age, salary and
department number. Assume that the records are stored in a sequential file where records are
ordered based on the employee's id.
"The aforementioned file makes it inefficient to get records with salaries ranging from Rs.
20,000 to Rs. 30'000."

- (c)
State whether the statement above is true or false with reasons.

Briefly explain two disadvantages that exist in static hashing.


(5 marks)

(3 marks)
(d) Explain the terms dense and sparse index.
(3 marks)
(e) Considerthe B+tree indexbelow.

i. Illustrate the tree after inserting 31 and 33.


(3 marks)
ii. illustrate the tree after deleting 2 and 3 from the Yoriginal tree.
(3 marks)
(I) Consider the Hash index below. Illustrate the hash index after inserting 50.

Bucket D

(5 marks)

Page 3 of 6
Question 3
25 marks

(a) What is the goal of query optimization? Why is it important?

(3 marks)
(b) Considerthe following relational schema and SQL query.
Suppliers (givd: integer, s#czme: char(20), cfty: char(20))
Supply(±Ld:integer,£2Ld:integer)
Part (EZLd: integer, p#cJ"e: char(20), price: real)

SELECT s.sname, p.pname


FROM Suppliers s, Parts p, Supply y
WHERE s.sid = y.sid AND y.pid = p.pid AND p.price s 1000

Howmanydifferentjoinorders,assumingthatcrossproductsaredisallowed,wiHaSystem
R style query optimizer consider when deciding how to process the given query? List each
of these join orders.

(3 marks)
Whatindexesmjghtbeofhe]pinprocessingthisquery?Explainbriefly.

(4 marks)
iii. How does adding DISTINCT to SELECT clause affect the plans produced?

(3 marks)
iv. Estimate the I/0 cost of retrieving records from Parts table that contains price less than or
equal 1000 rupees. Assume that 15% of tuples satisfy the selection criteria. There are 3300
pages in the Parts table, with 50 records each page. The clustered 8+ tree index on price
1 lJ __-_ _--V.-J-`+ lJ' 11\`, |Jlul^ |,JJ L'IJuC
attribute isisthe
theonlv
onlyinrlp¥
indexa`;ci;Icihla
available;nin+L^
the D^ul.
Parts +_ij_
table. mF
This .index
. .
takes up 1/3 of the table's
Space.

(8 marks)
V. Estimatethe1/0costofsorting200pagesofSupplierstableusing10bufferframes.

(4 marks)

Question 4
25 marks

(a) Why do DBMSs inter]eave actions ofmultip]e transactions? Briefly explain your answer.

(1 marks)
(b) Show a schedule that is unrecoverable? Briefly explain the schedule.

(3 marks)
(c) Briefly explain the terms c7cc7c7/ocfr prcvc#/z.o# and c7ec7c7/OCA deJ€c/7.om Explain approaches for
each methodology.

(3 marks)

Page 4 of 6
00750

(d) Considerthe following part of the schedule.

Tl T2 T3 T4

S(A)

R(A)

X(B)

W(B)

S(B)

S(D)

R(D)

X(D)

S(C)

R(C)

X(A)_

Assume that Transaction Ti is higher priority than transaction Ti+I(i.e. transaction Ti has higher
priority than T2; T2 has higher priority than T3; and T3 has higher priority than T4).

i. Draw a wait-For-Graph forthe given schedule above.


(2 marks)

ii. What should do next for deadlocks detection approach to break the deadlock after identify
it? (1 rna,-rk)

iii. Draw the schedule again considering deadlock prevention algorithm:


Wait-Die approach
(4 marks)

(e) Briefly explain simple Tree Locking algorithm.


(4 marks)

Page 5 of 6
oo750`

(I) Consider the following 8+ tree. Follow Sz.mp/e Tree I,oc4j.#gj4/gow.rfe" and specify when and
what lock get and release to do the followings.

I H E] I H I E] I
i. Search 1 1.

(1 marks)
ii. Delete 99.

(1.5 marks)
iii. Insert 30.

(1.5 marks)

(g) Considerthe following scenario:

Database D contains a relation I?. Relation J3 contains a page P. Page P contains a tuple f„

Assume that multiple granularity locking scheme is used. Describe the locks acquired when
reading all tup]es of page P.
(3 marks)

-End of the Question Paper -

Page 6 of 6

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy