DBMS Assignment
DBMS Assignment
Question No: 1
Design and draw an ER diagram that captures the information above. Use only the basic ER
model here; that is, entities, relationships, and attributes. Be sure to indicate any key and
participation constraints.
Question No: 2
Notown Records has decided to store information about musicians who perform on its
albums (as well as other company data) in a database. The company has wisely chosen to hire
you as a database designer (at your usual consulting fee of $2500/day).
Each musician that records at Notown has an SSN, a name, an address, and a phone
number. Poorly paid musicians often share the same address, and no address has more
than one phone.
Each instrument used in songs recorded at Notown has a unique identification
number, a name (e.g., guitar, synthesizer, and flute) and a musical key (e.g., C, B-flat,
E-flat).
Each album recorded on the Notown label has a unique identification number, a title,
a copyright date, a format (e.g., CD or MC), and an album identifier. Each song
recorded at Notown has a title and an author.
Each musician may play several instruments, and a given instrument may be played
by several musicians.
Each album has a number of songs on it, but no song may appear on more than one
album.
Each song is performed by one or more musicians, and a musician may perform a
number of songs.
Each album has exactly one musician who acts as its producer. A musician may
produce several albums, of course
Design and draw an ER diagram that captures the information above. Use only the basic
ER model here; that is, entities, relationships, and attributes. Be sure to indicate any key
and participation constraints.
Question No: 3
The Prescriptions-R-X chain of pharmacies has offered to give you a free lifetime supply
of medicine if you design its database. Given the rising cost of health care, you agree.
Here’s the information that you gather:
Patients are identified by an SSN, and their names, addresses, and ages must be
recorded.
Doctors are identified by an SSN. For each doctor, the name, specialty, and years
of experience must be recorded.
Each pharmaceutical company is identified by name and has a phone number.
For each drug, the trade name and formula must be recorded. Each drug is sold by
a given pharmaceutical company, and the trade name identifies a drug uniquely
from among the products of that company. If a pharmaceutical company is
deleted, you need not keep track of its products any longer.
Each pharmacy has a name, address, and phone number.
Every patient has a primary physician. Every doctor has at least one patient.
Each pharmacy sells several drugs and has a price for each. A drug could be sold
at several pharmacies, and the price could vary from one pharmacy to another.
Doctors prescribe drugs for patients. A doctor could prescribe one or more drugs
for several patients, and a patient could obtain prescriptions from several doctors.
Each prescription has a date and a quantity associated with it. You can assume
that, if a doctor prescribes the same drug for the same patient more than once,
only the last such prescription needs to be stored.
Pharmaceutical companies have long-term contracts with pharmacies. A
pharmaceutical company can contract with several pharmacies, and a pharmacy
can contract with several pharmaceutical companies. For each contract, you have
to store a start date, an end date, and the text of the contract.
Pharmacies appoint a supervisor for each contract. There must always be a
supervisor for each contract, but the contract supervisor can change over the
lifetime of the contract.
Design and draw an ER diagram that captures the information above. Use only the basic ER
model here; that is, entities, relationships, and attributes. Be sure to indicate any key and
participation constraints.
Question No: 4
Computer Sciences Department frequent fliers have been complaining to Dane County
Airport officials about the poor organization at the airport. As a result, the officials decided
that all information related to the airport should be organized using a DBMS, and you have
been hired to design the database. Your first task is to organize the information about all the
airplanes stationed and maintained at the airport. The relevant information is as follows:
Every airplane has a registration number, and each airplane is of a specific model.
The airport accommodates a number of airplane models, and each model is identified
by a model number (e.g., DC-10) and has a capacity and a weight.
A number of technicians work at the airport. You need to store the name, SSN,
address, phone number, and salary of each technician.
Each technician is an expert on one or more plane model(s), and his or her expertise
may overlap with that of other technicians. This information about technicians must
also be recorded.
Traffic controllers must have an annual medical examination. For each traffic
controller, you must store the date of the most recent exam.
All airport employees (including technicians) belong to a union. You must store the
union membership number of each employee. You can assume that each employee is
uniquely identified by a social security number.
The airport has a number of tests that are used periodically to ensure that airplanes
are still airworthy. Each test has a Federal Aviation Administration (FAA) test
number, a name, and a maximum possible score.
The FAA requires the airport to keep track of each time a given airplane is tested by a
given technician using a given test. For each testing event, the information needed is
the date, the number of hours the technician spent doing the test, and the score the
airplane received on the test.
Design and draw an ER diagram that captures the information above. Use only the basic ER
model here; that is, entities, relationships, and attributes. Be sure to indicate any key and
participation constraints.
Question No: 5
Question No: 6
Question No: 8
Question No: 10
Question No: 12
Question No: 13
Question No: 15
PATIENT (Patient#, Name, DOB, Address, (Prescription#, Drug, Date, Dosage, Doctor,
Secretary))
Question No: 16
R(A,B,C,D,E), F = {AC → E, B → D, E → A}
Question No: 17
Suppose that you are given a relation R = (A,B,C,D,E) with the following functional
dependencies: {CE → D,D → B,C → A}
Question No: 18
Suppose that you are given a relation R = (A,B,C,D,E) with the following functional
dependencies:
You are given the following set of functional dependencies for a relation R(A,B,C,D,E,F),
Question No: 20
Determine all the keys of relation R. Do not list super keys that are not a candidate key.
Question 21:
Consider the following transactions with data items P and Q initialized to zero:
read (Q) ;
if P = 0 then Q : = Q + 1 ;
write (Q) ;
read (P) ;
if Q = 0 then P : = P + 1 ;
write (P) ;
Any non-serial interleaving of T1 and T2 for concurrent execution leads to a schedule that is not
conflict serializable. Explain
Question 22:
Consider the following schedule for transactions T1, T2 and T3: Create a serializable sequence
Question 23:
Consider the following four schedules due to three transactions (indicated by the subscript) using
read and write on a data item x, denoted by r(x) and w(x) respectively. Which one of them is conflict
serializable? Explain
Question 24:
Consider the transactions T1, T2, and T3 and the schedules S1 and S2 given below.
Question 25:
Consider three data items D1, D2 and D3 and the following execution schedule of transactions T1, T2
and T3. In the diagram, R(D) and W(D) denote the actions reading and writing the data item D
respectively. Create a serializable sequence
Question 26:
a. Find the names of all employees who work for First Bank Corporation.
b. Find the names and cities of residence of all employees who work for First Bank
Corporation.
c. Find the names, street address, and cities of residence of all employees who work for
First Bank Corporation and earn more than $10,000 per annum.
d. Find the names of all employees in this database who live in the same city as the
company for which they work.
e. Find the names of all employees who live in the same city and on the same street as
do their managers.
f. Find the names of all employees in this database who do not work for First Bank
Corporation.
g. Find the names of all employees who earn more than every employee of Small Bank
Corporation.
h. Assume the companies may be located in several cities. Find all companies located in
every city in which Small Bank Corporation is located.
Question No: 27
c. Find those companies whose employees earn a higher salary, on average, than the
average salary at First Bank Corporation.
Question No: 29
a. Find the total number of people who owned cars that were involved in accidents in 1989.
b. Find the number of accidents in which the cars belonging to “John Smith” were involved.
c. Add a new accident to the database; assume any values for required attributes.
e. Update the damage amount for the car with license number “AABB2000” in the accident
with report number “AR2197” to $3000.
Question No: 30 Overview and Features of db4
74 103 9/8/98
85 Art 3 25.5
95 Bob 3 63.5
Boat
Using the above table write Relational Algebra Expression and SQL Query for the following
Question No: 47
1. Find the names of sailors who have reserved at least one boat
2. Find the names of sailors who have reserved a red or a green boat.
3. Find the names of sailors who have reserved a red and green boat
4. Find the sids of all sailors who have reserved red boats but not green boats
5. Find the names of sailors who have not reserved a red boat
Question No: 49
1. Find the names of sailors who have reserved at least two boats.
2. Find the sids of sailors with age over 20 who have not reserved a red boat.
3. Find the names of sailors who have reserved all boats.
4. Find the names of sailors who have reserved all boats called Interlake
5. Find sailors whose rating is better than some sailor called Horatio
Question No: 50
Question No: 51
1. Find the age of the youngest sailor for each rating level.
2. Find the age of the youngest sailor who is eligible to vote (i.e., is at least 18 years old) for each rating
level with at least two such sailors.
3. For each red boat, find the number of reservations for this boat
4. Find the average age of sailors for each rating level that has at least two sailors.
Question No: 52
Assume that the tree is initially empty and values are added in ascending order. Construct B+-trees for the
cases where the number of pointers that will fit in one node is as follows:
a. Four
b. Six
c. Eight