DatabaseDesign-PastYearExamPap

27
DATABASE DESIGN AND MANAGEMENT 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: Compute the following for the relations above: (b) The relational schema for an on-line bookstore is given below. Customer (Custno, Name, Address, State) Book (Bookno, Title, Author, Price) Order (Orderno, Custno, Bookno, ShipDate) Inventory (Bookno, Quantity, Warehouseno, ShelfLocation) Warehouse (Warehouseno, Region) Write relational algebra expressions for the following queries. (i) List the details of the books, with price $20 in the warehouse in Singapore region. The list should include quantity of books available. [5marks] Page 1 of 27

description

database development paper

Transcript of DatabaseDesign-PastYearExamPap

Page 1: DatabaseDesign-PastYearExamPap

DATABASE DESIGN AND MANAGEMENTREFERENCES:Book Title: Fundamentals of Database Systems (6th Edition)Author: Ramez Elmasri, Shamkant B. NavathePublisher: 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:

Compute the following for the relations above:

(b) The relational schema for an on-line bookstore is given below.

Customer (Custno, Name, Address, State)Book (Bookno, Title, Author, Price)Order (Orderno, Custno, Bookno, ShipDate)Inventory (Bookno, Quantity, Warehouseno, ShelfLocation)Warehouse (Warehouseno, Region)

Write relational algebra expressions for the following queries.(i) List the details of the books, with price $20 in the warehouse in Singapore region. The

list should include quantity of books available. [5marks](ii) Find books ordered by customer C200 that has not shipped yet. [5marks](iii) Find the details of other books purchased by the customers who purchased book

Bno12345. [6 marks](iv) Find the total number of books in each price value. [4 marks]

Page 1 of 23

Page 2: DatabaseDesign-PastYearExamPap

(c) Explain the functions of Client/Server DBMS. [8 marks]

(d) Discuss the major changes of Client/Server DBMS functions from traditional database. [8 marks]

[TOTAL FOR QUESTION 1: 50 MARKS]

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.

SchedulesA1 = 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] [12 marks](ii) C2 = W1[x] W1[y] R2[x] R3[y] W2[x] W3[y] [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

Page 3: DatabaseDesign-PastYearExamPap

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

Page 4: DatabaseDesign-PastYearExamPap

(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, RoleFrom Student, ProjectWhere Student.StudentId = Project.StudentIdAnd Module = IS352

Page 4 of 23

Page 5: DatabaseDesign-PastYearExamPap

(i) Identify ANY TWO query strategies for the above query. [16 marks]

(ii) Show that ONE of the query strategies is an optimum strategy. [3 marks]

(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]

[TOTAL FOR QUESTION 3: 50 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) Find the Employee-No, Names, Street and regions of residence of all employees who work for Informatics and earn more than $50,000 per year. [6 marks]

(ii) Find the list of employees in the database who do not work in Informatics. [6 marks](iii) Cambridge University has its own branches located in several regions. Find all

companies located in every Region in which Cambridge University is located. [6 marks](iv) Find the number of employees working in companies in the same region in which they

are living. [8 marks]

Page 5 of 23

Page 6: DatabaseDesign-PastYearExamPap

(b) What is meant by optimum query processing in using relational algebra expression? [6 marks]

(c) Draw an optimum relational algebra expression query tree for the following SQL query.

SELECT Employee-No, Region, Company-Name, Company.RegionFROM Employee, Works, CompanyWHERE Employee.Employee-No = Works.Employee-NoAND Works.Company-Name = Company.CompanyNoAND Salary > 50000AND Employee.Region ="West"AND Company.Region "West"

[18 marks][TOTAL FOR QUESTION 1: 50 MARKS]

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]

QUESTION 3

Page 6 of 23

Page 7: DatabaseDesign-PastYearExamPap

(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) Give examples of three simple predicates that may be used in horizontal Fragmentation of the Video Rental Company relations for horizontal partitioning. Give an example of horizontal fragment for each predicate. [18 marks]

(ii) How would a derived horizontal partitioning for PRODUCT, INVENTORY or ORDER may be defined based on any ONE of the fragments identified in Q3.a. i. [8 marks]

(iii) Explain how the PRODUCT relation may be vertically fragmented. [6 marks]

(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

Page 8: DatabaseDesign-PastYearExamPap

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

Page 9: DatabaseDesign-PastYearExamPap

[TOTAL FOR QUESTION 3: 50 MARKS]

2013-12:

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

Page 10: DatabaseDesign-PastYearExamPap

The following query is executed at location 3.

SELECT CustNo,CustAddress, TelNo, OrderNo, ProductNo, QuantityFROM Customer, Product, Order, OrderProductWHERE Order.OrderNo = OrderProduct.OrderNoAND Order.CustNo = Customer.CustNoAND OrderProduct.ProductNo= Product.ProductNoAND Make = ‘Philips’AND Date = 31-12-2006;

The cost of data transfer from location to another is $0.10 per Kilobytes and all other costs are negligible compared to data transfer cost.

(i) Identify any THREE query processing strategies to execute the query at Location 3. [9 marks]

(ii) Calculate the cost involved in executing any TWO strategies of the above THREE strategies identified and hence identify the strategies that requires minimum data transfer cost, assuming that there are 10000 matches for the Products in the OrderProduct relation. [12 marks]

[TOTAL FOR QUESTION 1: 40 MARKS]

QUESTION 2

Page 10 of 23

Page 11: DatabaseDesign-PastYearExamPap

(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

Page 12: DatabaseDesign-PastYearExamPap

[TOTAL FOR QUESTION 2: 40 MARKS]

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) Data-Entry-operator can retrieve or modify only Customer and Product relations and grant any of these privileges to other users. [3 marks]

(ii) Sales-Assistant can retrieve all the attributes of Order, Order-Product and Product except for Price and PName. [12 marks]

(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 manufacturer’s 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:

Page 12 of 23

Page 13: DatabaseDesign-PastYearExamPap

QUESTION 1

Consider the following relations:Sailor (Sailor_id, Sailor_name, date_of_birth)Boat (Boat|_id, Boat_name, colour,)Reserves (Sailor_id, Boat_id, date)

(a) Write relational algebra expressions that satisfy the following information requirements:

(i) 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) Give two different relational algebra expressions that correctly implement the following query and show that one is optimum when compared with the other. “Give the names (Sailor_name) of all sailors that reserved a green boat for 01/01/05” [13 marks]

(b) Sample records for the two relations are given below.

Produce the results of the following Queries:

Page 13 of 23

Page 14: DatabaseDesign-PastYearExamPap

(i) Boat (Blue, Red) [4 marks]

(ii) Boat Reserves (Note this is an equijoin) [8 marks]

QUESTION 2

An investment firm database must include information about the firm’s 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

Page 15: DatabaseDesign-PastYearExamPap

S3 = T1R(X) T1R(Y) T1W(X) T2R(X) T2R(Y) T2W(X) T2W(Y).

(i) Identify the concurrency problems associated with each of the above schedules. [6 marks]

(ii) Either by drawing the serialization graph or otherwise, identify which of the schedules are serializable and which are not serializable. [6 marks]

(iii) Explain whether the strict 2PL schedule will resolve the problems that you found in each schedule. [6 marks]

(b) Consider a database schema that represents customer orders at a company. Each order contains one or more line items. Orders are represented using two relations.

Orders (ordernumber, customerid, total)Lineitems(ordernumber, Item_id, item_type)

The following predicates appear in the majority of queries:

Total <= 1000 Total <= 5000Item_type = 0 Item_type = 1

(i) Write down the fragments that result from performing primary horizontal fragmentation on the Orders and Line Items using the predicates above. [7 marks]

(ii) The above fragments in (Q3 b(i) ) can be further fragmented using derived horizontal fragmentation. Write down the resulting fragments. [8 marks]

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

Page 16: DatabaseDesign-PastYearExamPap

(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]

(c) Consider the following scenario:

A number of vendors use several warehouses from which they ship various items. Each vendor is identified by a VendorNumber, each warehouse by a WarehouseNumber and each item by an ItemNumber. For every shipment made a unique shipment number is assigned. A shipment can consist of several different items and also multiple occurrences of any of those items.

Construct an ER diagram model for this scenario utilizing an associative entity, that is a relationship which has its own primary key that is NOT part of the primary key of any of the entities that participate in that relationship. The diagram must show all primary keys. [17 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

Page 17: DatabaseDesign-PastYearExamPap

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, f-stop, and price.

The photographs are to be grouped into three categories: Landscapes, Portraits and General (everything else). Landscape has information about the location of where the photograph was taken. Portrait has information about the model used The General category can be easily extended to describe other types of photographs, such as Underwater, Nature, Sports, War, etc.

A location is identified by a unique number, and a model by its name.

[15 Marks]

(b) Consider the following two relations R and S:

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

(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,

Page 17 of 23

Page 18: DatabaseDesign-PastYearExamPap

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 2 reads to R1 and 2 writes to R12 reads to R2

T2 3 reads to R12 reads to R3 and 1 write to R3

T3 2 reads to R2 and 1 write to R22 reads to R3

[15 marks]

(b) Consider the following set, F, of functional dependencies:

AB C D EGC A BE CBC D CG BDACD B 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.

Mike’s “minimal cover”:AB CC A

Page 18 of 23

Page 19: DatabaseDesign-PastYearExamPap

BC DCD BD ED GBE CCG DCE G

Dave’s “minimal cover”:AB CC ABC DD ED GBE CCG BCE 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 publisher’s 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

Page 20: DatabaseDesign-PastYearExamPap

(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:-

Show that a multi-valued dependency exists within this relation and normalize the relation to 4NF. [13 Marks]

[TOTAL FOR QUESTION 3: 33 MARKS]

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]

Page 20 of 23

Page 21: DatabaseDesign-PastYearExamPap

QUESTION 5

(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 Driver. Driver_id, Vehicle.Vehicle_id, Count(Trips.Trip_no)FROM Driver , Driver_vehicle , Vehicle , TripsWHERE Driver. Driver_id = Driver_vehicle. Driver_idAND Driver_Vehicle.Vehicle_id = Vehicle.Vehicle_idAND Vehicle. Vehicle_id= Trips. Vehicle_idAND Driver Driver. Driver_idAND Vehicle_id = ‘SH4004’AND date >01-01-2004AND date <31-03-2004

(i) Identify two different query strategies to execute the query at Smale. [4 Marks]

(ii) Calculate the cost involved in executing the two strategies and hence identify the optimum price-related strategy. [7 Marks]

Page 21 of 23

Page 22: DatabaseDesign-PastYearExamPap

(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

Page 23: DatabaseDesign-PastYearExamPap

(i) Identify the predicate used to create the fragments. [1 Mark](ii) Write relational algebra expressions to create the horizontal fragments based on the

predicate identified. [1 Mark](iii) Show whether the given fragments satisfy complete, disjoint and reconstruction

conditions. [7 Marks]

(c) Consider the following relational schema:

DOCTORS (Dr id, Name, Specialty, Telephone, Years of experience)PATIENTS (Patient id, Name, Sex, Address, Age)RECORDS (Dr id, Patient id, Date, Diagnosis)

Write relational algebra expressions for the following queries:(i) List the names of doctors and patients in pairs, so that, for each pair, the patient is over

60 years old and saw the doctor in 1999. [5 Marks](ii) Find the names of all male patients who have never seen a doctor. [4 Marks](iii) Find the patient name and diagnosis for all patients treated by doctors with the

specialty “Neuro surgery” [4 Marks]

[TOTAL FOR QUESTION 5: 33 MARKS]

Page 23 of 23