Inheritance PDF
Inheritance PDF
FACULTY OF ENGINEERING
MAY 2014
INSTRUCTIONS TO CANDIDATES
Derive a relational schema (database tables) from the ER diagram. Specify all
necessary primary keys, foreign keys and any other constraints.
[10 marks]
Page 1 of 6
DATABASE SYSTEMS – CSE 1012Y(1)
Question 1 [Cont’d]
Table 1
Normalize Table 1 to 3NF, showing all the intermediate normal forms, relations
and functional dependencies. Clearly specify all assumptions made.
[10 marks]
Page 2 of 6
DATABASE SYSTEMS – CSE 1012Y(1)
The following tables form part of a database held in a Relational Database Management
System:
Employee (empNo, eName, salary, position)
Aircraft (aircraftNo, aName, flyingRange)
Flight (flightNo, from, to, flightDistance, departTime, arriveTime)
Certified (empNo, aircraftNo)
Where
Employee contains details of all employees (pilots and non-pilots) and empNo is
the key.
Aircraft contains details of aircraft and aircraftNo is the key.
Flight contains details of the flights and flightNo is the key.
Certified contains details of the staff who are certified to fly an aircraft, and
empNo/aircraftNo form the key.
(i) List the employee numbers of pilots certified for Boeing aircraft.
[3 marks]
(ii) List the aircraft that can fly nonstop from Glasgow to New York. Note that
the flying range of the aircraft is greater than the flight distance.
[4 marks]
(ii) List the employee numbers of employees who have the highest salary.
[3 marks]
Write a stored procedure sp_del_emp that takes an employee number and deletes
the employee if he/she exists. An appropriate message is displayed indicating if
deletion is successful or not. In case any error is raised, it is notified in the form of
an error message.
[7 marks]
Page 3 of 6
DATABASE SYSTEMS – CSE 1012Y(1)
(a) Dynamic Multilevel Indexes can be implemented using B+ trees. In a B+ tree, data
pointers are stored only at the leaf nodes of the tree, which are usually linked
together for ordered access on the search field.
(i) Construct a B+ tree of order p=3 and pleaf=2 for the following set of key
values, inserted in the order in which they appear: 2, 3, 5, 7, 11, 17, 19, 23,
29.
[8 marks]
(ii) From your resulting B+ tree of part (i) delete the following key values in
the given order: 29, 23
[4 marks]
(b) Hashing is a technique that provides fast access to records on certain search
conditions.
(i) Describe two methods in internal hashing which can be used to resolve
collisions when records hash to a bucket which is already full.
[2 x 2 marks]
[2 x 2 marks]
Page 4 of 6
DATABASE SYSTEMS – CSE 1012Y(1)
One of the most desirable features for a Database Management System (DBMS) is
concurrency control. Locks are used in DBMSs to control concurrency in transaction
processing systems.
(a) Two types of locking commonly used by DBMSs are Binary Locks and
Read/Write Locks. Explain how Read/Write Locks are better than binary locks.
[4 marks]
(b) Consider the following transactions T1 and T2 for a banking application (Table 2)
and a possible concurrent execution of the two transactions (Table 3)
T1 T2 T1 T2
Table 2
Table 3
(i) Assume that the initial values of A, B and C are 200, 300 and 100. If the
transactions did not execute concurrently, the final value of Sum would be
600. However, with the interleaving of T1 and T2 shown in Table 3 above,
the final value of Sum would be 500. Describe the problem that occurred in
Table 3.
[4 marks]
(ii) Add lock and unlock instructions to T1 and T2 which satisfy Two-Phase
Locking protocol (2PL). Assume that locks are requested only when they
are required and are released as soon as possible. Your answer should also
show a possible interleaving such that the problem in (b) (i) no longer
arises.
[12 marks]
Page 5 of 6
DATABASE SYSTEMS – CSE 1012Y(1)
(b) A data warehouse integrates multiple databases and other information sources
into a single repository. It is well equipped for providing the data for data mining.
Page 6 of 6