Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
7 views5 pages

A) B) C) D) E) F) : Questions: 6 Pages: 2

Uploaded by

muqaram606
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views5 pages

A) B) C) D) E) F) : Questions: 6 Pages: 2

Uploaded by

muqaram606
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

BIRLA INSTITUTE OF TECHNOLOGY & SCIENCE, PILANI, DUBAI CAMPUS

DUBAI INTERNATIONAL ACADEMIC CITY, DUBAI


SECOND SEMESTER 2022 – 2023 Questions: 6
DEPARTMENT OF COMPUTER SCIENCE Pages: 2

COURSE : Database Systems (CS F212)


COMPONENT : MidTerm - (Closed Book) WEIGHTAGE : 30% (60 Marks)
DATE/Hour : 05-04-2023 AN DURATION : 90 Minutes
Note: Please read the questions clearly before attempting. Write down any assumptions that you
make. Show your work in steps.

Q1.Given a relation R( A, B, C, D, E) and Functional Dependency set


FD = { A → B, B → E, C → D}.
Answer the following questions given below: [12M]
a) Identify the super keys.
b) Identify the maximum number of super keys in the given relation R.
c) Identify the candidate keys.
d) Identify the prime attributes and non-prime attributes.
e) Clearly discuss each individual FD and mentioned the normal form as well.
f) Identify the highest normal form for the given R.

Q2. Consider the following schema and answer the following questions in relational algebra if
possible, justify otherwise. [10M]
Suppliers(sID, sName, address)
Parts(pID, pName, colour)
Catalog(sID, pID, price)

Catalog[sID] ⊆ Suppliers[sID]
Catalog[pID] ⊆ Parts[pID]
a) If sID is a key for the Suppliers relation, could it be a key for the Catalog relation?
b) Find all prices for parts that are red or green. (A part may have different prices from
different manufacturers.)
c) Find the sIDs of all suppliers who supply a part that is red or green.
d) Find the sIDs of all suppliers who supply a part that is red and green.

Q3. Create the following tables with given attributes having appropriate data type and specify
the necessary primary and foreign key constraints:
Voter (VoterId, Votername, Gender, Boothid, Checkvote)
Booth (Boothid, Location,BIncharge )
[ Note: Assume 1entered for voted; 0 for not voted in Checkvote of Voter relation.]

(i). List the number of voters Boothwise [2M]


(ii). List the number of Male voters voted boothwise [2M]

1
Q4. Consider the following Computer hardware relation schema and write SQL for the
following: [9M]
Hardware (Hardware_id, Hardware_Name, Manufacturer_Name, Release_Year)
Hardware_Inventors(Hardware_id, Inventor_Name)
Manufacturer(Manufacturer_Name, Address, Phone)
Hardware_Stock(Hardware_id, Distributor_id, Quantity)
Purchase (Hardware_id, Distributor_id, Customer_ID, Purchase_Date, price, Quantity)
Distributor(Distributor_id, Distributor_Name, Address)
(i). Retrieve details of all hardwares such as id, name, name of manufacturers, inventors,
quantity with each distributor.
(ii). Get the particulars of customers who have purchased more than 5 hardwares in the financial
year 1st April 2022 to 31st March 2023.
(iii). Create a view of all hardwares and its quantity that are currently available with the
distributor.

Q5. Consider the following relational schema.


Player(P_ID, name, country)
Match(M_ID, title, year)
Coach(C_ID, C_name, age)
PLAY(p_ID, M_ID, SAL)
Referee(C_ID, M_ID)
Write the Relational Algebra expressions for the following: [5 x 2 = 10M]
(i) Find the names of all players from UAE.
(ii) Find the titles of all matches coached by “ Martin ”.
(iii) Find the highest amount of money a player has ever made from a single match.
(iv) Find the oldest age of any coach.
(v) Find the C_IDs of the coaches that have worked with all the players.

Q6. Draw an ER Diagram for the description of a Medical Center(MC). [15M]


The MC keeps information about each patient in a folder. Each folder is assigned a unique string,
called reference number, of length 40 that helps to identify the patient and makes the sorting of
the folders easier. This folder contains the following information: SSN, Name, Date of Birth,
Gender, Address, Contact Phone Number, more than one Emergency Contact (each has Name and
Phone number), and a list of visits (to the doctor office or to the MC's hospital) made by the patient.
Each visit has the following information: date, a doctor, a nurse, reason, fee, and the amount the
patient has paid. As a rule, the fee is always greater or equal the amount the patient has paid, which
is greater than or equal 0. The folder of a patient is created at his/her first visit.
The MC keeps information about each doctor in a folder. Each folder is also assigned a unique
string, called reference number, of length 40 that helps to identify the doctor and makes the sorting
of the folders easier. This folder contains the following information: SSN, Name, Date of Birth,
Gender, Address, Contact Number, Specialty, the first working day of the doctor at MC, and the
doctor's salary. MC pays its doctors between US$100,000 and US$400,000.
The MC keeps information about each nurse in a folder. Each folder is also assigned a unique
string, called reference number, of length 40 that helps to identify the nurse and makes the sorting
of the folders easier. This folder contains the following information: SSN, Name, Date of Birth,
Gender, Address, Contact Number, the first working day of the nurse at MC, and the nurse's salary.
MC pays its nurses between US$30,000 and US$70,000.
***********
2
BIRLA INSTITUTE OF TECHNOLOGY & SCIENCE, PILANI, DUBAI CAMPUS
DUBAI INTERNATIONAL ACADEMIC CITY, DUBAI
SECOND SEMESTER 2022 – 2023
DEPARTMENT OF COMPUTER SCIENCE
COURSE : Database Systems (CS F212)
COMPONENT : Compre - (Closed Book) WEIGHTAGE : 40% (80 Marks)
DATE/Hour : 31-05-2023 12:30 - 03:30PM DURATION : 3Hrs.
Note: Please read the questions clearly before attempting.
Write down any assumptions that you make. Show your work in steps.
PART - A
Q1. Consider the following schema. (10M)
EmployeeDetails (EmpId, FullName, ManagerId, DateOfJoining, City)
EmployeeSalary(EmpId, Project, Salary, Variable)
a. Write SQL query to find the 3rd highest salary from a table without using the TOP/limit
keyword.
b. Write an SQL query to fetch all the Employees who are also managers from the
EmployeeDetails table.
c. Write an SQL query to fetch all employee records from the EmployeeDetails table who
have a salary record in the EmployeeSalary table.
d. Write an SQL query to fetch the project-wise count of employees sorted by project’s
count in descending order.
Q2. Given the set F of FDs shown below, find a canonical cover for F. Let's call Functional
dependencies Fc = {X ⇒ Z, XY ⇒ WP, XY ⇒ ZWQ, XZ ⇒ R}. (6M)
Q3. Given a relation R( P, Q, R, S, T, U, V, W, X, Y) and Functional Dependency set FD = {
PQ → R, P → ST, Q → U, U → VW, and S → XY}, determine whether the given R is in
3NF? If not convert it into 3 NF. (14M)
Q4. Check whether the given schedule S is conflict serializable or not. If yes, then determine
all the possible serialized schedules. Additionally, please check whether it is possible to
recover in case of failure. (10M)

1
PART - B
B1. Write a mysql stored function that can calculate factorial of a given number. (6M)
B2. Consider the following schema and sample entries in the tables. (Assume that more
records are inserted already) (6M)
Olympics(year, host, kind)
Medals(country, sport, year, event, medal)
Olympics:
Year Host Kind
2012 UK Summer
2010 Canada Winter
Medals:
Country Sport Year Event Medal
USA Swimming 2012 100m freestyle Gold
USA Swimming 2012 400m freestyle silver
a) Write a relational algebra expression that list sports in which the US Won a medal in a
summer Olympics.
b) Write a relational algebra expression that lists names of countries that won a medal at
a Summer Olympics but that never won a medal at a Winter Olympics. List each
country name only once.
B3. Consider the requirement specification below that describe a database of directors, movies
and awards. Represent all possible key and participation constraints in an ER Diagram. A
director is described by a name, movie genre and Date of Birth(DoB). No two directors have
the same combination of name and DoB. Each movie has a name. No two movies have the
same name. An award has a name, which uniquely identifies it. Directors make movies. A
movie is made by one or several directors. A director who made no movies is not tracked in
the database. Directors receive awards. A director may receive the same award more than once
in different years. All years in which a director received a particular award must be recorded.
(6M)
B4. Assume that a disk has block size B = 512 bytes. A block pointer is P = 6 bytes long. The
file has 50,000 fixed length EMPLOYEE records. Each EMPLOYEE record has the following
fields: Name (30 bytes), Ssn (10 bytes), Department_code (9 bytes), Address (52 bytes), Phone
(10 bytes), Birth_date (8 bytes), Sex (1 byte), Job_code (4 bytes), and Salary (4 bytes). Ssn is
the primary key. Calculate number of file blocks and number of index records per block. (4M)

B5. a)Construct a left-biased B Tree of order m = 3 for the following keys: 31, 5, 20, 23, 50,
70, 90, 99, 19, 29, 89, 93, 33, 43, 45, 49, 47, 48. (12M)
b) Delete 70 and 47 from the tree constructed for the above sequence of keys
c) Insert 100 to the result of B5.b.

B6. a) Construct the extendable hash structure with the following search key values: 31, 5, 20,
23, 50, 70, 90, 99, 19, 29, 89, 33, 32. Consider hash function h(x) = x mod 8 and start from
most significant bits (MSB). Each bucket can hold two records. (10M)
b) Find the load factor or utilization.

2
Load factor = 13/16 = 81.25%
******** ALL THE BEST ********

You might also like