Presentation is loading. Please wait.

Presentation is loading. Please wait.

Switch off your Mobiles Phones or Change Profile to Silent Mode.

Similar presentations


Presentation on theme: "Switch off your Mobiles Phones or Change Profile to Silent Mode."— Presentation transcript:

1 Switch off your Mobiles Phones or Change Profile to Silent Mode

2 Revision on Past Question Paper

3 Question 1

4 May 2012 The following relational schema specifies a part of a relational database for a college information system: Student(S#, S_Name, Gender, DOB, Address, Tel) Module (M#, M_Name, L#) Lecturer (L#, L_Name, Gender, DOB, Address, Tel) Enrolment(S#, M#, Semester, Year)

5 May 2012 The following assumptions are made: Student enrolment for a module is specified by the student number (S#), module number(M#), semester (e.g. ‘spring’, or ‘autumn’), and year. Answer the following questions: Identify the primary key, and foreign key(s) if applicable, for each of relations above. Indicate clearly which relation contains which foreign key(s). [4 marks]

6 May 2012 Student PRIMARY KEY (S#), Module PRIMARY KEY (M#), FOREIGN KEY (L#) Lecturer PRIMARY KEY (L#) Enrolment PRIMARY KEY (S#, M#) FOREIGN KEY (S#) FOREIGN KEY (M#)

7 May 2012 Specify correct sequence in which above four relations should be created, and the order in which relations should be dropped (removed). [3 Marks] Entities with foreign keys must be created only after entities with associated primary keys. Entities with foreign keys must be dropped (removed) before entities with associated primary keys.

8 May 2012 Example of Sequence of CREATE statements: Student -> Lecturer -> Module -> Enrolment Example of Sequence of DROP statements: Enrolment -> Module -> Lecturer -> Student

9 May 2012 Express each of the following queries firstly in SQL and secondly in Relational Algebra: Find names of all modules which are taught by lecturer Dr David and with word ‘Programming’ in module name. [4 marks] SELECT M.M_Name FROM Module M, Lecturer L WHERE M.L# = L.L3 AND L.L_Name = ‘Dr David’ AND M.M_Name = ‘Programming’

10 May 2012 Express each of the following queries firstly in SQL and secondly in Relational Algebra: Find names of all modules which are taught by lecturer Dr David and with word ‘Programming’ in module name. [4 marks] Join Module and Lecturer over L# giving T1 Select T1 where Name = ‘Dr David’ AND M_Name = ‘Programming’ T2 Project T2 over M_Name giving result

11 Question 2

12 May 2012 In the context of transaction processing discuss the concepts of: Transaction record Contains information on transaction start, end (commit or abort) Contains details of all updates during the transaction processing Checkpoint record Contains a list of transactions still in process at the time of the checkpoint being taken

13 May 2012 In the context of transaction processing discuss the concepts of: Commit This operation signals a successful end of transaction. It tells the transaction manager that a logical unit of work has been successfully completed. The database should be in a consistent state again.

14 May 2012 The following list represents the sequence of operations in an interleaved execution of a set of transactions T1, T2,...T11 in a concurrency system based on locking, where A, B,...H are data items. Assume that FETCH A requires an S lock on A, UPDATE A requires an X lock on A, and all locks are held until end-of-transaction (COMMIT or ROLLBACK).

15 May 2012 timetransactionoperation time t0 time t1T1FETCH A time t2T4FETCH D time t3T5FETCH A time t4T2FETCH E time t5T2UPDATE E time t6T3FETCH F time t7T2FETCH F time t8T1COMMIT time t9T6FETCH A

16 May 2012 timetransactionoperation time t10T5ROLLBACK time t11T6FETCH C time t12T6UPDATE C time t13T7FETCH G time t14T8FETCH H time t15T9FETCH G time t16T9UPDATE G time t17T8FETCH E time t18T7COMMIT

17 May 2012 timetransactionoperation time t19T9FETCH H time t20T3FETCH G time t21T10FETCH G time t22T9UPDATE H time t23T2UPDATE F time t24T11FETCH A time t25 Determine whether there are any deadlocks at time t25 by providing a Wait-For-Graph (WFG). [10 marks]

18 May 2012 timetransactionoperationwait time t0 time t1T1FETCH AS lock A time t2T4FETCH DS lock D time t3T5FETCH AS lock A time t4T2FETCH ES lock E time t5T2UPDATE EX lock E time t6T3FETCH FS lock F time t7T2FETCH FS lock F time t8T1COMMITRelease time t9T6FETCH AS lock A

19 May 2012 timetransactionoperationwait time t10T5ROLLBACKRelease time t11T6FETCH CS lock C time t12T6UPDATE CX lock C time t13T7FETCH GS lock G time t14T8FETCH HS lock H time t15T9FETCH GS lock G time t16T9UPDATE Gwait time t17T8FETCH Ewait time t18T7COMMITRelease

20 May 2012 timetransactionoperationwait time t19T9FETCH HS lock H time t20T3FETCH Gwait time t21T10FETCH GS lock G time t22T9UPDATE HX lock H time t23T2UPDATE Fwait time t24T11FETCH AS lock A time t25

21 Wait For Graph T3 T2 T9 T8 T10 The system is deadlocked at t25: Circular path: T8 waits for T2 on E T2 waits for T3 on F T3 waits for T9 on G T9 waits for T8 on H F H E G G

22 May 2012 Discuss how the system could recover if it were deadlocked at time t25, and justify your choice of the 'best’ victim transaction(s).[4 marks] To break the deadlock, transaction T2, or T3, or T8, or T9 would need to be rolled- back. T9 should be chosen as the victim transaction, as it would not only break deadlock but also release locks required by T10 at same time.

23 Question 3

24 May 2012 Consider the following relational schema for a database used by an IT consultancy, which provides a range of IT support services to its client. CLIENT (C#, c_name, addr, phone) SERVICE (S#, C#, P#, cost) PRODUCT (P#, p_name, p_type)

25 May 2012 Note that: Each product has its name and belongs to one product type ( e.g. ‘Oracle’, ‘DB/2’, ‘Linux’). The product type information is recorded in the p_type attribute of the PRODUCT relation. CLIENT relation contains 1000 records. SERVICE relation contains 3000 records. PRODUCT relation contains 4000 records, of which 50 are for products in the product type ‘Oracle’.

26 May 2012 Express the following query in SQL: Find the names of those clients who have received services using any ‘Oracle’ type product. [2 marks] SELECTcname FROM CLIENT, SERVICE, PRODUCT WHERECLIENT.C# = SERVICE.C# ANDSERVICE.P# = PRODUCT.P# ANDp_type = ‘Oracle’;

27 May 2012 Choose two possible methods to evaluate the query. Express each of the methods using both the relational algebra and a query tree. Clearly show all the steps required in the evaluation. [7 marks] Method 1: Join CLIENT and SERVICE giving T1 Join T1 and PRODUCT giving T2 Restrict T2 where p_type = ’Oracle’ giving T3 Project T3 over cname to give result

28 May 2012 Choose two possible methods to evaluate the query. Express each of the methods using both the relational algebra and a query tree. Clearly show all the steps required in the evaluation. [7 marks] Method 2: Restrict PRODUCT where p_type = ’Oracle’ giving T1 Join T1 and SERVICE giving T2 Join T2 and CLIENT giving T3 Project T3 over cname to give results

29 May 2012 Client Service Join Restrict Project Result Query Tree – Method 1 (Join – Select – Project) Over P# Where p_type = ’Oracle’ Over cname Join Product Over C#

30 May 2012 For each method, clearly indicate the size (number of tuples) for each of the intermediate relations produced at each step. Recommend the best method based on the results. [7 marks] Method 1: Calculate sizes for T1, T2, T3 correctly T1: 3000 tuples T2:3000 tuples T3:up to 50 tuples

31 May 2012 For each method, clearly indicate the size (number of tuples) for each of the intermediate relations produced at each step. Recommend the best method based on the results. [7 marks] Method 2: Calculate sizes for T1, T2, T3 correctly T1: 50 tuples T2: up to 50 tuples T3:up to 50 tuples

32 May 2012 Briefly outline the four stages involved in the query optimisation process. [4 marks] Convert query into some internal form more suitable for machine manipulation Convert to canonical form Further convert internal form into some equivalent and more efficient canonical form making use of well defined transformation rules

33 May 2012 Briefly outline the four stages involved in the query optimisation process. [4 marks] Choose a set of candidate low-level procedures using statistics about database Generate a set of candidate query plans and choose best (cheapest) of those plans by evaluating cost formulae

34 Question 4

35 May 2012 Describe the objectives of database recovery and database security. [4 marks] Recovery It deals with the issue of how a database system can recover from physical or software failures when they occur in the system;- robustness of the system.

36 May 2012 Describe the objectives of database recovery and database security. [4 marks] Security It deals with the issue of how to protect data from unauthorised use; - to ensure only authorised users are allowed to use the database and they do so under the access right control imposed by the system.

37 May 2012 Identify the three types of failure in a database system.[3 marks] There are generally three types of failure in a database system: Transaction failure: a transaction fails to complete (as a result of program or data 'failure') Media failure (hard crash): damage to (part of) a database (e.g. disk corrupt, 'unreadable')

38 May 2012 Identify the three types of failure in a database system.[3 marks] System failure (soft crash): affecting all transactions currently in progress but no damage to the database (e.g. power failure causing lost of data in main memory)

39 May 2012 Discuss two of the methods used for database recovery from system failures, namely, deferred update and immediate update. [6 marks] Deferred update Do not actually update the database (disk) until partially commit state is reached. If transaction fails to reach partially commit it will not have changed the database in any way – no need to undo the failed transactions.

40 May 2012 Discuss two of the methods used for database recovery from system failures, namely, deferred update and immediate update. [6 marks] Immediate update Writing operations carried out immediately to disk. If a transaction fails the effect of its operations must be undone.

41 May 2012 Transaction processing is a key component of a relational database system. Explain the concept of transaction, and provide a diagram to clearly depict the state transition for transaction execution.[7 marks]

42 May 2012

43 Question 5

44 May 2012 Discuss difference between a distributed database system and a decentralised database system. [6 marks] Distributed database is a single logical database that is spread physically across computers in multiple locations that are connected by data communications network. Sites of a distributed system may be distributed over a large area (e.g. nationally or even globally) or over a small area (e.g. over several floors of same building or a college campus). Computers may range from PC’s to mainframes.

45 May 2012 Discuss difference between a distributed database system and a decentralised database system. [6 marks] Decentralised database is also stored on computers at multiple locations, however, computers are not connected by a network. Consequently, data cannot be shared by users at different sites. Thus a decentralised database is best regarded as a collection of independent databases, rather than having the geographical distribution of a single database.

46 May 2012 Briefly explain each of the following fragmentation rules: Completeness Reconstruction Disjointedness [4 marks] Completeness Each data item from a 'global' relation R must appear in at least one of its fragments. This rule ensures no loss of data during fragmentation.

47 May 2012 Briefly explain each of the following fragmentation rules: Completeness Reconstruction Disjointedness [4 marks] Reconstruction It must always be possible to reconstruct each global relation from its fragments. This rule ensures no loss of functional dependencies.

48 May 2012 Briefly explain each of the following fragmentation rules: Completeness Reconstruction Disjointedness [4 marks] Disjointness Each data item from global relation should appear in only one of its fragments, except for vertical fragmentation where primary key attributes must be repeated to allow reconstruction. This rule ensures minimal data redundancy.

49 May 2012 There are different fragmentation options in distributing data. Demonstrate in detail how horizontal and vertical fragmentation options can be performed by providing one example of each, using the following relation STUDENT: Horizontal Fragmentation With Horizontal partitioning some of rows of table are put into a base relation at one site. Other rows are put into base relation at another site. More generally, rows of relation are distributed to many sites.

50 May 2012 There are different fragmentation options in distributing data. Demonstrate in detail how horizontal and vertical fragmentation options can be performed by providing one example of each, using the following relation STUDENT: Vertical Fragmentation Here some of columns of a table are projected into base relation at one of sites and other columns are projected into a base relation at different site. Often, columns may be projected to several sites. Relations at each of sites must share common attribute (primary key being duplicated at each site) so that original table can be reconstructed if required.


Download ppt "Switch off your Mobiles Phones or Change Profile to Silent Mode."

Similar presentations


Ads by Google