Sei sulla pagina 1di 9

UNIVERSITY OF MAURITIUS

FACULTY OF ENGINEERING

SECOND SEMESTER EXAMINATIONS MAY 2010


PROGRAMME BSc (Hons) Computer Science BSc (Hons) Electronics and Computer Science BSc (Hons) Information and Communication Technologies BSc (Hons) Information Systems MODULE NAME DATE Database Systems Monday 17 May 2010 TIME NO. OF QUESTIONS SET 09.30 12.30 Hrs 6 DURATION NO. OF QUESTIONS TO BE ATTEMPTED 3 hours 4 MODULE CODE CSE 2002Y(3)

INSTRUCTIONS TO CANDIDATES There are 2 Sections in this paper: Section A and Section B. Section A consists of 3 questions. Question 1 is compulsory. Answer any other one question from Section A. Section B consists of 3 questions. Answer any 2 questions from Section B. Use separate answer books for each Section.

DATABASE SYSTEMS CSE 2002Y(3)

SECTION A
Answer 2 questions from this Section. Question 1 is compulsory. Answer any other question from this Section.
Use separate answer books for each Section. Question 1 (Compulsory 30 marks) a) Below is a sample of a delivery notice issued by Tom's Pastry.

DELIVERY NOTICE TOM'S PASTRY Member Number: 123 Member Name and Address: 12/09/98 John H. Smith 23 Petunia Gardens East Chipping Rustenburg Item Code 1234 Description Unit Price 3-Tier 34.5 Vienna Deluxe American 1.25 Pie Raisins 0.25 Qty 2 Tax Code A Order Number: 0582 Order Date:

Tax (%) 10

Amount 75.90

5678 2345

37 200

A Z

10 0

50.88 50.00 24.00 200.78

Delivery Cost Total Status: Delivery should be expected within 2 weeks

Assume that one order can be for one member only and that the delivery cost is specific for each order. i. ii. iii. Represent the above data in ONF format. [2 marks]

Identify and explain problems associated with the resulting relation in part (i). [4 marks] Turn this relation into a set of fully normalized relations in 3NF. Show all functional dependencies, intermediate relations and keys. [7 marks] /Contd next page Page 1 of 8

DATABASE SYSTEMS CSE 2002Y(3) Question 1 (Contd)

b)

The Mauritius Turf Club has set up a database to keep track of the races at the Champ de Mars, the horses and riders participating in the races and the results. The database schema used is as follows:

Horse{HorseName, BirthDate, Origin, Stable} Rider{Name, BirthDate, Nationality} Race{RaceDate, RaceNum, Distance, Sponsor} RaceResults{RaceDate, RaceNum, HorseName, RiderName, Result} Formulate the following queries in Relational Algebra: (i) (ii) (iii) (iv) (v) List the names of horses from the 'Fok' stable. [1 mark]

Display the nationalities of the riders who took part in race number 4 on [2 marks] 7th August 2009. Find the nationality of riders who have ridden a horse of 'South African' origin. [2 marks] Find the names of riders who have never ridden the horse 'Magic Warrior'. [3 marks] For each stable, find the number of horses which took part in the races on 7th August 2009. [3 marks]

c)

Refer to question 1(b), write a trigger which ensures that any insert, update or delete of a row in the horse table is properly recorded in a horse_audit table. [6 marks]

Page 2 of 8

DATABASE SYSTEMS CSE 2002Y(3) Question 2 (20 marks) a. b. Describe the difference between primary and secondary index. You are given an instance of the following Employee table EMP_ID 23832 23650 24001 24009 23831 23903 23904 23666 23901 23902 23905 23906 23907 23688 24005 MGR_NAME DEPARTMENT YEAR Gary Rob Rob Rob Mary Kate Kate Kate Kate Kate Kate Kate John John John Finance Management Management Management Admin Advertising Advertising Advertising Advertising Advertising Advertising Advertising IT IT IT 1996 2000 1994 1999 1997 1998 1997 2001 1998 1996 1997 1996 2001 1996 1996 WRK_HOUR 323 398 247 136 112 213 237 283 432 238 331 291 348 321 435 [2 Marks]

Assume that each Disk Block can store up to four (4) tuples. Build the following Indexes for the Employee relation. Note that your blocks diagrams may include only Key field values that are being considered. (i) (ii) A primary sparse index on the sequential file on the Key field EMP_ID. [3 Marks] Assuming that the relation instance above is stored in a data file sorted in ascending order with respect to EMP_ID attribute: Build a secondary index on the key field YEAR. The index entries have variable-length records, with a repeating field for the pointer. [5 Marks] c. The University database consists of the following relations: student(ssn, name, programme) course(cid, name, description, department, insid) took(ssn, cid, semester, grade) required(programme, cid) instructor(insid, name, department) /Contd next page Page 3 of 8

DATABASE SYSTEMS CSE 2002Y(3) Question 2 (Contd) Note that: took.cid and required.cid are foreign keys, they refer to the course.cid course.insid is a foreign key, it refers to instructor.insid took.ssn is a foreign key, it refers to student.ssn student.programme indicates the programme the student is enrolled in Give Tuple Relational Calculus Expressions for the following queries: (i) Find the ssn of students who took the course 'Programming'. [2 Marks] (ii) Find the name of all the courses that are NOT being taught by the instructor 'Smith'. [2 Marks] Find the name of each student who took some course for semester 'one', that is required by the programme 'Computer Science'. [2 Marks]

(iii)

Give Domain Relational Calculus Expressions for the following queries: (i) List the names and their respective departments of all courses which DO NOT have students. [2 Marks] For every instructor from the 'CSE' department, list the instructor ID, the course ID he teaches and the programme in which the courses are found. [2 Marks]

(ii)

Question 3 (20 marks)

a)

(i) (ii)

List the ACID properties. Explain the usefulness of each.

[6 marks]

By giving suitable examples explain three problems which can occur [9 marks] when transactions are run concurrently.

b)

Explain how schemas are defined in a three-schema architecture and why mappings are needed. [5 marks]

Page 4 of 8

DATABASE SYSTEMS CSE 2002Y(3)

SECTION B
Answer 2 questions from this Section.
Use separate answer books for each Section.

Question 4 (25 marks) a) Discuss the types of transparency required for data independence in a distributed DBMS [6 marks] With respect to client-server architectures, discuss the performance with multiple clients and multiple servers. [4 marks] Consider the Movie relation below where a few tuples are described. Group_Type can have values as Bollywood or Hollywood only. Language can have values as English or Hindustani only. Movie_Type can have values as Fiction or Comedy or Thriller only.

b)

c)

Movie_Name Avatar 3 Idiots Right Or Wrong Bad Teacher i.

Group_Type Hollywood Bollywood Bollywood Hollywood

Language English Hindustani Hindustani English

Movie_Type Fiction Comedy Thriller Comedy

Perform a horizontal fragmentation of relation Movie with respect to the following predicates: P1 : P2: P3 : P4 : Group_Type = Bollywood Group_Type = Hollywood Movie_Type = Fiction Movie_Type = Comedy [4 marks]

ii.

Explain why the resulting fragments in part (i) do NOT fulfill the correctness rules of fragmentation. [3 marks] Modify the predicates in part (i) so that they partition relation Movie obeying the correctness rules of fragmentation. Use COM_MIN algorithm and deduce the fragments that result from performing primary horizontal fragmentation on the Movie table using the modified predicates. [8 marks]

iii.

Page 5 of 8

DATABASE SYSTEMS CSE 2002Y(3) Question 5 (25 marks) Consider a banking institution having branches in different countries whereby all the information is stored in a distributed database. Assume that the database consists of a relation EMPDETAILS that stores additional information about employees. EMPDETAILS: {Name, Family, Age, Position} The following applications are defined to run on this relation: Q1: Find the Name and Family of an employee, given the age. SELECT Name, Family FROM EMPDETAILS WHERE Age > 50 Q2: Find the Age and Position of all employees in ascending order of age. SELECT Age, Position FROM EMPDETAILS ORDER BY Age ASC Q3: Find the family of an employee, given the position. SELECT Family FROM EMPDETAILS WHERE Position = Manager Q4: Find the maximum age of employees. SELECT MAX(Age) FROM EMPDETAILS Queries are issued at THREE sites: A, B and C. The application access frequencies are given in the table below: Site A 20 10 80 2 Site B 1 5 1 5 Site C 0 9 9 4

Q1 Q2 Q3 Q4

Answer the following questions, showing all the working details: a) Using the information given, identify the attribute usage matrix and construct the AA (Attribute Affinity) matrix. [5 marks] /Contd next page Page 6 of 8

DATABASE SYSTEMS CSE 2002Y(3) Question 5 (Contd) b) The next step after the AA matrix is generated is to group together attribute(s) having high affinity for each other. i. Identify a suitable algorithm used for clustering of attributes. Give a brief explanation of the algorithm. [2 marks] Use the clustering algorithm identified above to find the (CA) Clustered Affinity Matrix. [10 marks] The final step to obtain the vertical fragments is to use a partitioning algorithm on the clustered attributes. i. Briefly explain how partitioning is performed with split quality. [3 marks] Using split quality, perform vertical splitting of the CA matrix obtained in part (b)(II) to get the resulting fragments. Assume that the primary key of relation EMPDETAILS is Name. [5 marks]

ii.

c)

ii.

Question 6 (25 marks) a) Consider the following relations: Employee (EID, EName, EAddress, EPhoneNum) ParkingPlace (PID, PName, Location, EID)

These relations are implemented in a distributed database system. The first relation Employee is stored at site A and the second relation ParkingPlace is stored at site B. Suppose the following query is issued at site C: Select all the employee names who have a parking in Engineering Tower SELECT EName FROM Employee E, ParkingPlace P WHERE E.EID = P. EID AND location = Engineering Tower Assume that Each tuple is 2000 bits long. Employee and ParkingPlace have 4000 and 800 tuples respectively. Estimated number of parking available in Engineering Tower is 80. Data transfer rate is 1,000 bits per second. Data access rate is 100,000 bits per second.

/Contd next page Page 7 of 8

DATABASE SYSTEMS CSE 2002Y(3) Question 6 (Contd) (i) Discuss the idea of query processing in distributed databases. [5 marks]

(ii)

Compute the processing time (in seconds) of the following strategies of processing the above query.

Strategy A: Perform selection for parking at site B and move results from site B to A. Further evaluate the query at site A by computing join with Employee. Finally transfer results to site C.

Strategy B: Transfer all relations from sites A and B to site C. Evaluate query and process the result at site C. [4 + 4 marks]

(iii)

Comment on the difference in processing time in (ii).

[2 marks]

b)

(i)

Discuss the different information requirements for fragment allocation [8 marks] Explain how total cost is calculated in the fragment allocation model. [2 marks]

(ii)

END OF QUESTION PAPER

/ph

Page 8 of 8

Potrebbero piacerti anche