Professional Documents
Culture Documents
DatabaseDesign PastYearExamPap
DatabaseDesign PastYearExamPap
DatabaseDesign PastYearExamPap
REFERENCES:
Book Title: Fundamentals of Database Systems (6th Edition)
Author: Ramez Elmasri, Shamkant B. Navathe
Publisher: Addison-Wesley; 6 edition (April 9, 2010)
ISBN-13: 978-0136086208
2014-08:
QUESTION 1
(a) Let R(A,B,C) and S(B,C,D) be the relations:
Page 1 of 23
QUESTION 2
(a) Consider a database with objects x and y. There are two transactions T1 and
T2.Transaction T1 reads objects R1(x) and R1(y) and then writes W1(x) and
W2(y). Transaction T2 reads objects R2(x) and R2(y) and writes W2(x) and
W2(y).
Commit and Abort on transactions are given as Commit (1) & Commit (2) and
Abort (1) & Abort (2).
Identify the concurrency problems associated with each of the following
Schedules.
Schedules
A1 = R1(x) W1(x) Commit(1) R2(x) R2(y) W2(y) W2(x) Commit(2)
A2 = W1(x) W2(x) W2(y) W1(y)
A3 = R1(x) R2(x) W2(x) Commit(2) R1(x) W1(x) Commit(1)
A4 = R1(x) W1(x) R2(x) W2(x) R2(y) Commit(2) Abort(1)
[8 marks]
(b) There is a concurrency problem in the following schedule. Check whether a
2PL schedule will resolve the problem.
B1 = R1(x) R2(x) W1(x) W2(x)
[8 marks]
(c) Identify whether the following schedules are serializable or not (use the
conflict operations available in the given schedule to construct the conflict
serialization graph).
There are three transactions T1, T2 and T3.
(i)
C1 = W1[y] R3[x] R2[x] R3[y] W2[x] W3[y] W1[x]
(ii)
C2 = W1[x] W1[y] R2[x] R3[y] W2[x] W3[y]
[12 marks]
[8 marks]
(d) A database has three relations R1, R2 and R3. They have to be distributed
over four sites S1, S2, S3 and S4. Each of the three relations has to be
allocated to one of the four sites using the non redundant best fit method.
Page 2 of 23
There are only three transactions T1, T2 and T3. The originating sources for
each transaction (that is the sites at which they are run) and the frequency
with which the transactions run are shown in the table given below. The table
also includes the user transaction which are described in terms of frequency
of occurrence, which relation they access and whether the accesses are reads
or writes.
Transaction sources and frequencies are:
[14 marks]
[TOTAL FOR QUESTION 2: 50 MARKS]
QUESTION 3
The horizontal fragments of the relation Student and Project are as given below.
Page 3 of 23
(a) Identify the fragmentation criteria based on which the relations Student and
Project have been fragmented. [8 marks]
(b) The fragments Student-Basic and Project-1 are allocated to site 1 and the
fragments Student-Elective and Project-2 are allocated to site 2.
The following SQL query is placed in site 3 and the result is needed in site 3.
Select StudentId, Sname, Project-Topic, Role
From Student, Project
Where Student.StudentId = Project.StudentId
And Module = IS352
(i)
[16 marks]
(ii)
(c) Explain how the fragments Project-1 can be further fragmented based on the
Module attribute. [6 marks]
(d) Making database information available to web users requires converting it
from the database format to a mark up language such as HTML or XML. In
addition, a bridge between the web and databases needs to be built.
Explain any THREE technologies and architectures that may be used to build
bridges between web and enterprise database. [9 marks]
(e) Discuss any TWO of the following database administration issues with regard
to 24*7 databases.
High Availability
Scalability
Performance
Backup and Recovery
[8 marks]
2014-04:
QUESTION 1
(a) Consider the following relational schema:
Employee(Employe-No, Employee-Name, Street, Region, Manager-No)
Works(Employee-No, Company-Name, AnnualSalary, Date-of-Joining)
Company(Company-Name, Street, Region)
Give the relevant Relational Algebra expressions for the following queries.
(i)
(ii)
(iii)
(iv)
QUESTION 2
(a) Given the following schedule, Schedule - 1, show whether there is
concurrency problem present in the given schedule with initial value A = 100
and B = 60. [8 marks]
(b) In the Schedule - 1, given above, identify the conflict operations and hence
draw a precedence graph and find if the schedule is conflict serializable or
not. [12 marks]
(c) Show what happens if 2PL is used to execute the above schedule. [18 marks]
(d) Discuss the architecture of a client-server system.[12 marks]
[TOTAL FOR QUESTION 2: 50 MARKS]
Page 6 of 23
QUESTION 3
(a) A video rental company rents three categories of products: Music albums,
Films and Video games. It has four stores in all the four regions: North, South,
East and West. It has two warehouses, A and B, from which shipments of the
products are done.
The relational schema is as given below.
PRODUCT(ProdId, Category, Description, Price)
INVENTORY(ProdId, StoreRegion, StockOnHand)
ORDER(OrderId, ProdId, Warehouse)
(i)
(ii)
(iii)
(b) In a distributed database, the relations in node 1 and node 2 and application
query on Node 3 are as given below. [18 marks]
Page 7 of 23
Identify any TWO methods of processing the above query and identify the
OPTIMUM method among the two methods (to minimize the cost). Assume
that the major cost is involved only in shipping the data among the nodes
and is proportional to the bytes of data to be transferred (that is, other cost
are negligible).
Page 8 of 23
QUESTION 1
(a) Consider the following database at carsales.com, owned by a company in
Singapore that sells used cars.
CUSTOMER (Cid, CName,CStreet, CRegion)
CAR (CarRegdNo, OwnerName, Price, Model, Manufacturer)
SALES (SaleNo, Cid, CarRegdNo, SaleDate, PaymentMode)
OWNER (OwnerName, OwnerStreet, OwnerRegion)
Write the following queries in relational algebra expressions.
(i) List the cars sold, manufactured by Ford Company. [5 marks]
(ii) Find the number of cars sold in the year 2009 for each model
manufactured by Nissan company. [6 marks]
(iii)List the sales number, CarRegdNo, its price, model, customers and date of
sales for cars purchased by customers in Jurong region after 2008 that
cost more than $20000. [8 marks]
(b) A distributed database system has been designed for A Customer delivery
system and is located in three locations 1, 2 and 3. The relational schema
and the details of relations in the respective locations are given below.
Page 9 of 23
(ii)
QUESTION 2
Page 10 of 23
(a) For the following transaction schedules, Schedule 1 and Schedule 2, draw the
precedence graphs and determine whether they are conflict serialisable or
not. [14 marks]
(b) Draw the wait-for graph for the following interleaved transactions and hence
detect whether there exists deadlock in the given transactions or not. [14
marks]
(c) What is the main difference between discretionary access control and
mandatory access control? [6 marks]
(d) Discuss any TWO methods that could be used to manage concurrent access
in a Database management System. [6 marks]
Page 11 of 23
QUESTION 3
(a) What is the Common Gateway Interface (CGI) and how is it used for Web
database connectivity? [5 marks]
(b) Consider the relational database schema given below. Suppose that all the
relations were created and owned by the designer, who wants to grant the
following privileges to users Data-Entry-operator and Sales-Assistant.
Write the DCL syntax for granting the privileges as described in (i) and (ii).
Customer(CustomerId, CustomerName, Date-of-Birth, Salary)
Order(OrderId, OrderDate, CustomerId)
OrderProduct(OrderNo,ProductNo,Qty-Ordered)
Product(ProductNo, PName, Price)
(i)
(ii)
(c) A country-wide drug supplier chain operates from four different cities, A, B,C
and D in the country, has the following tables in its database:
DrugShop (DSId, DSCity, DSContactNo)
Medicine (MedId, MedName, ManuId)
Manufacturer (ManuId, ManuName, ManuCity)
Order (MedId, DSId, Qty)
Distributed database has to be designed keeping in mind the frequent query,
"List the manufacturers names who belong to the same city in which the
drug shop that has placed an order resides."
Suggest a fragmentation schema (Horizontal and Derived Horizontal
fragments) for the above database. [20 marks]
[TOTAL FOR QUESTION 3: 40 MARKS]
2005-04:
QUESTION 1
Consider the following relations:
Sailor (Sailor_id, Sailor_name, date_of_birth)
Page 12 of 23
Give the colours of all boats for which the sailor named John has
reservations. [4 marks]
(ii)
Give the name, and Sailor_id for all sailors that have reservations for at
least one blue boat and for at least one red boat [4 marks]
(iii)
(b) Sample records for the two relations are given below.
Boat
(ii)
Boat
Page 13 of 23
QUESTION 2
An investment firm database must include information about the firms various
offices, brokers employed by the firm, investors (i.e. firm's customers) and their
investment portfolios.
The firm has a number of offices. An office is identified by its ID, and the address
and phone number of each office must be recorded. For each broker, the database
must record his/her name, years with the company and the office where he/she
works.
Each broker is paid a fixed salary and commission at a fixed rate. The salary and the
rate of commission depend on the broker's category (probationer, junior, senior,
partner).
Each investor's interests are looked after by a broker who helps him/her buy and sell
stock. Typically, an investor owns a quantity of each of several stocks. The current
nominal value of the stock (per share), the market value (also per share) and the
dividend (as % of the nominal value) should also be recorded.
The un-normalized relation is as given below:
InvestmentFirm (InvestorID, StockID, Quantity, InvestorName, NominalValue,
MarketValue, Dividend, BrokerID, BrokerName, Yrs_with_firm, Category, Salary,
Rate_of_commission, OfficeID, OfficePhone, OfficeAddress)
(a) Identify all the functional dependencies for the above scenario. [16 marks]
(b) Hence give the BCNF relations (do not go through 1NF, 2Nf and 3NF). [6
marks]
(c) Suppose that instead of recording the current dividend for a stock, we need
to record the dividend history and also record the promotion history of
brokers, that is not just their current category but also previous categories,
but without storing any dates. Identify the multi-values dependencies that
these new requirements cause and hence find a fourth normal form
decomposition for InvestmentFirm. [11 marks]
QUESTION 3
(a) Consider a database with objects X and Y. There are two transactions T1 and
T2. Transactions T1 reads objects X and Y and then writes X. Transaction T2
reads objects X and Y and writes X and Y.
Consider the following three schedules:
S1 = T2R(X) T2R(Y) T2W(X) T1R(X) T1R(Y) T1W(X) T2W(Y),
S2 = T2R(X) T2R(Y) T1R(X) T R(Y) T1W(X) T2W(X) T2W(Y),
Page 14 of 23
(ii)
(iii)
Explain whether the strict 2PL schedule will resolve the problems that
you found in each schedule. [6 marks]
(i)
(ii)
QUESTION 4
(a) In the following two relations, identify the highlighted feature shown and
rectify the errors or anomalies that those features exhibit. [10 marks]
Page 15 of 23
(b) Check the Integrity constraints on the relations Parent and Child given below
and rectify any violations. (Note that both Pid and Cid should be built to a
common format of one letter followed by two or three numbers) [6 marks]
2004-08:
QUESTION 1
(a) An Art gallery maintains a database of photographs that can be bought over
the internet.
The database has three functions:
1.
maintaining the catalogue with entities photograph and photographer;
2.
selling the photos with entities transaction and customer;
3.
maintaining the payment particulars with entities payment and credit
card details.
The ER diagram of the existing system is shown in the diagram below. The
primary keys are given in parenthesis.
Page 16 of 23
You are required to enhance this ER model to an EER one by adding the
following details:
The database will store some technical information for every photograph,
like the type (colour or black and white), type of film, shutter speed, fstop, and price.
Compute:
(i)
R
S
(ii)
S {b, c}
(iii)
(where < means alphabetic order on letters)
[18 Marks]
[TOTAL FOR QUESTION 1: 33 MARKS]
QUESTION 2
Page 17 of 23
(a) A small database with only three relations, R1, R2 and R3 is distributed over
three sites, S1, S2 and S3. You are to allocate each of the three relations R1,
R2 and R3 to one of the three sites S1, S2 and S3 using the nonredundant
best fit method, (which is one technique which helps DBAs to decide how to
distribute data across sites).
There are only three transactions run on this database: T1, T2 and T3.
The originating sources for each transaction (that is the sites at which they
are run) and the percentage frequency with which the transactions run are
shown below:Transaction sources and frequencies
T1 sources S1 and S2 20%
T2 sources S1 and S3 30%
T3 sources S2 and S3 50%
Note that transactions are equally likely to originate from any of their
sources.
The usage made of each relation by each transaction is given by:Transaction behaviour
T1
T2
3 reads to R1
2 reads to R3 and 1 write to R3
T3
[15 marks]
(b) Consider the following set, F, of functional dependencies:
AB C
CA
BC D
ACD B
D EG
BE C
CG BD
CE AG
Two analysts, Mike and Dave have each produced a different minimal cover
for F (given below).
Decide and give reasons for your decision whether each or either of these
actually is a minimal cover for F.
Mikes minimal cover:
AB C
Page 18 of 23
CA
BC D
CD B
DE
DG
BE C
CG D
CE G
Daves minimal cover:
AB C
CA
BC D
DE
DG
BE C
CG B
CE G
[18 Marks]
[TOTAL FOR QUESTION 2: 33 MARKS]
QUESTION 3
Tomes On Line, an internet only bookseller, requires a database to keep information
on all of its offered books, together with their authors, publishers, and warehouse
locations where the books are stocked. For each publisher, the database must
record the publisher code, name, and the publishers address(es). A publisher can
have several different addresses. No two publishers have the same name.
For each book, the database must record its ISBN code, title, the publisher code, the
price, and published format (Possible formats are: hardback, paperback and/or
audioCD). Note that for any title published in several formats, each separate format
has a distinct ISBN code. In addition, the database must record the identity number
and name of each of the authors of the book. If there is more than one author, they
must be listed in the order in which they are listed on the book. This may or may not
be ordered alphabetically. Furthermore the warehouse location and number in stock
at that warehouse are also recorded for each book.
For each warehouse, the database must record the identity number, the name, the
location, and the number of employees at that warehouse.
(a) Identify the possible functional dependencies. [14 Marks]
(b) Hence give the BCNF relations (do not go through the intermediate normal
forms 1NF, 2NF, 3NF). In each of your relations identify the primary key. [6
Marks]
Page 19 of 23
(c) A previous attempt at constructing this database had produced the relation
WROTE (ISBN_CODE, AUTHOR_NUMBER, FORMAT)
with some sample data as shown in the table below:-
QUESTION 4
(a) Draw the conflict graph for the following schedule, S, of four transactions:
S: W1(x)W2(x)R3(x)R3(y)R1(y)R1(x)W4(y)
Hence determine whether or not the schedule is serializable. [10 Marks]
(b) Consider the following schedule of four transactions. Show how this schedule
would be executed under strict 2PL (two phase locking).
R1(y)W4(x) R4(y)R3(w)R2(y)W1(y)W1(x)W2(x)W2(z)W3(x)R4(z)
[12 Marks]
(c) (i) What will happen when a 2PL is applied to the following schedule?
C = R1(x)R2(y)W2(y)R2(x)W2(x)R1(y)C1C2
[5 marks]
(ii) Consider the following protocol:
[6 Marks]
[TOTAL FOR QUESTION 4: 33 MARKS]
QUESTION 5
Page 20 of 23
(a) A distributed database system has been set up for the Klatchian Delivery
Service and is located at two regional sites, Laotan and Elharib. The HQ site is
at Smale, and no data is actually held there.
The relational schema and the details of records in the respective relations
are given below.
You can assume that the cost of data transfer from one site to another is
$1.00 per kb. and that all other costs are negligible compared with the data
transfer cost. Furthermore you can assume that one Vehicle will make only
one trip in a day and that during the period 01-01-2004 to 30-04-2004, a
vehicle will make a maximum of 90 trips
At HQ in Smale, the SQL Query given below is used to get information about
the number of trips made by the vehicle with vehicle_id=SH4004 during the
period 01-01-2004 to 31-03-2004.
SELECT
FROM
WHERE
AND
AND
AND
AND
AND
AND
(i)
(ii)
Calculate the cost involved in executing the two strategies and hence
identify the optimum price-related strategy. [7 Marks]
Page 21 of 23
(b) Consider the relation Student_Unit with attributes and data given by:-
A horizontal fragmentation of this relation into relations F1, F2, F3, and F4 has
been made with the fragments given as:-
Page 22 of 23
(i)
(ii)
(iii)
Page 23 of 23