Академический Документы
Профессиональный Документы
Культура Документы
Question 1
(b) Briefly discuss why data fragmentation could be useful in such distributed
database systems, and explain each of the following fragmentation rules:
Completeness
Reconstruction
Disjointness
[8 Marks]
(c) Demonstrate in detail how these rules are enforced when performing
horizontal and vertical fragmentation, by using the STUDENT relation given
below:
[10 Marks]
Question 2
The following is the relational schema of part of the database that Acme Pty Ltd recently
implemented:
Using the above schema, write SQL queries that will answer/process the following:
a. List all cities where an employee lives. Only show the city once.
b. What is the lowest salary paid for any employee that lives in the city of
Melbourne?
1
c. For each qualification, show the total number of employees that have that
qualification. Show qualification id, qualification and the total number.
d. List any employees who are on annual leave on 01/08/2001. Note, date format is
#01-08-2001#. Show employee number only.
e. What is the total salary cost incurred by Acme for employees in the Marketing
department?
f. List the employee(s) with the highest salary. Show employee number and name.
g. List the employee names and all of the institutions that they have studied at.
h. How many employees have no qualifications?
i. Delete all leave rows if the leave ended prior to the start of this year.
j. Increase the salary of all employees by $80
[2+2+2+2+2+2+2+2+2+2=20 marks]
Question 3
Question 4
(b) Consider the following two interleaved transactions A and B which might
occur in a database system for a bank.
Mr Smith’s bank account, with an initial balance of $1000, is being
updated simultaneously by two transactions A and B in the order
shown below:
1. Transaction A retrieves the account balance
2. Transaction A transfer out $300 from the account and updates
the account balance.
3. Transaction B retrieves the account balance.
4. Transaction B transfer $200 into the account
5. Transaction A executes a rollback.
6. Transaction B commits the transaction.
2
Answer the following questions
(i) Show the step-by-step changes to the account balance and the final
balance of the account, if transaction A and B were performed
according to the sequence shown above.
[4 Marks]
(ii) Show the step-by-step changes to the account balance and the final
balance of the account, if transactions A and B were performed in a
serial sequence (i.e., Transaction A completes all its operations before
Transaction B starts).
[4 Marks]
Question 5
(a) Discuss the role that data replication plays in distributed database
management systems.
[7 Marks]
(b) Explain the effect that replication has on read-only and update transactions.
[4 Marks]
(c) Give details of two strategies for performing updates in a replicated distributed
database environment. State one disadvantage of each strategy.
[6 Marks]
3
(d) The components of a Distributed Database include the following: Network
Processor, Remote data processor, Data dictionary, and local data processor.
Explain the function of each of the above components.
[8 Marks]
QUESTION 6
4
time t27 T12 Fetch D
time t28 T12 Fetch C
time t29 T2 Update F
time t30 T11 Update C
time t31 T12 Fetch A
time t32 T12 Update D
time t33 T4 Fetch G
time t34
(i) Determine whether there are any deadlocks at time t34 by providing a
Wait-For-Graph. [12 Marks]
(ii) Discuss how the system could recover if it were deadlocked at time t34
and justify your choice of ‘victim’ transaction(s). [4 Marks]
QUESTION 6
(a) The term Security refers to the protection of the database against unauthorized
access, either intentional or accidental.
(i) Define the two main approaches of a security rule.
[3 Marks]
(ii) Define a security rule, by using the view mechanism, such that the user
Fred is allowed to see (i.e select) the name, the address and the job title
of each employee of status less than 100, for the following database:
[7 Marks]
CREATE TABLE Employee (
Emp_id CHAR(10),
Name VARCHAR(30),
Address VARCHAR(80),
Job_title VARCHAR(30),
Job_type CHAR(10),
Salary INT,
PRIMARY KEY (Emp_id)
FOREIGN KEY (Job_type) REFERENCES Status_def ) ;
CREATE TABLE Status_def (
Job_type CHAR(10),
Status INT,
PRIMARY KEY (Job_type, Status) ) ;
Question 7
5
Concurrency is defined as the process of managing simultaneous operations on the
database without having them interfere with one another.
(i) Describe one of the possible problems generated by concurrent access to the
same data. Support your answer with appropriate diagram and explanation.
[5 marks]
(ii) Illustrate how the problem can be resolved by using the locking mechanism.
[4 marks]
(iii) Can there be any additional problems that can occur using the locking
mechanism? If Yes, then how could they be resolved?
[4 marks]
(iv) Produce a wait-for graph for the following transaction scenario, and determine
whether deadlock exists. If there is a deadlock, explain how the deadlock can
be broken. Give a reason for choosing the victim.
[12 marks]
6
Question 8
(a) A distributed database (DDB) is a collection of multiple, logically interrelated
databases which are physically distributed over a computer network”
(i) Give three advantages of a Distributed Database as compared to a
centralized database.
[6 marks]
(ii) Differentiate between a Homogeneous DDB and a Heterogeneous
DDB and explain under what circumstances would such systems
generally arise?
[6 marks]
(iii) Discuss some of the advantages of having data replicated at various
sites.
[3 marks]
QUESTION 9
[3 marks]
(b) Discuss the idea of query processing in distributed databases using the example given
below.
SELECT *
7
FROM Books B, Libraries L, Availability A
WHERE B.Book-ID = A.Book-ID AND L.Lib-ID = A.Lib-ID
AND Year = ‘1999’ AND Location = 'London' ;
[14 marks]
QUESTION 10
(a) Describe the three types of potential mistake which could occur if concurrency control is
not properly enforced in the database system. Support your answer with appropriate
example for each.
[9 marks]
(b) Describe the data access protocol based on the compatibility matrix.
[5 marks]
(d) Explain how a deadlock state can be detected and how the system can break such a state.
[7 marks]
QUESTION 11
Consider the following relational schema that correspond to a part of the database
for a computer training college, which offers a variety of IT courses:
STUDENT(S#, S_Name, S_DOB, S_Address)
COURSE(C#, C_Name, StartDate, EndDate, Fee, D#)
DEPARTMENT(D#, D_Name, D_Location)
GRADE(S#, C#, Grade, Date_of_Grade)
The following assumption are made with regard to the size of each relation:
The STUDENT relation contains 1000 records
The COURSE relation contains 100 records
The DEPARTMENT relation contains 10 records
The GRADE relation contains 5000 records
There are no more than 50 students in any one course
It is possible to hold up to 50 records for an intermediate relation in the main
memory.
8
(a) Discuss the objective of query optimisation in a database system, and briefly
describe various stages involved in the query optimisation process.
[8 Marks]
(c) Provide two possible options to evaluate the above query. Express each of
these options in relational algebra and clearly show all the steps required in
the evaluation of the query.
[4 Marks]
(d) For each of the options identified in (c) above, calculate the number of total
tuple input/output operations required for each step. Recommend the best
options based on the results
[11 Marks]