Subject: Introduction to Databases
Subject code: CSE 3151
Theory Assignment 2
Last date: 15-05-2024
This assignment is designed to give you practice with the concepts of
Key terms related to normalization such as functional dependency,
attribute closure, canonical cover etc.
Designing relational database schema using decomposition and
normalization techniques
Expressing queries using formal relational query languages
Transaction management
1. A database of research articles in a journal uses the following schema.
(VOLUME, NUMBER, STARTPAGE, ENDPAGE, TITLE, YEAR, PRICE)
The primary key is (VOLUME, NUMBER, STARTPAGE, ENDPAGE) and the following
functional dependencies exist in the schema.
(VOLUME, NUMBER, STARTPAGE, ENDPAGE) → TITLE
(VOLUME, NUMBER) → YEAR
(VOLUME, NUMBER, STARTPAGE, ENDPAGE) → PRICE
The database is redesigned to use the following schemas.
(VOLUME, NUMBER, STARTPAGE, ENDPAGE, TITLE, PRICE)
(VOLUME, NUMBER, YEAR)
Which is the weakest normal form that the new database satisfies, but the old
one does not?
2. Consider the following schema, with given constraints:
books(accessionno, isbn, title, author, publisher)
users(userid, name, deptid, deptname)
accessionno → isbn
isbn → title
isbn → publisher
isbn →→ author
userid → name
userid → deptid
deptid → deptname
a. What is the highest normal form whose properties are satisfied by the
schemas?
b. Normalize the schemas with given constraints to 4NF.
3. Consider the following relational schemas
a. Employee (ename, ecity, state)
b. Works (ename, company name, salary)
c. Company (company name, city)
d. Manages(ename, managername)
Write the expressions to solve the following queries using Relational Algebra,
Tuple Relational Calculus, and Domain relational Calculus.
a. Write the expressions to find the name of the employees getting salary more
than 60,000 and working in TCS and WIPRO.
b. Write the expressions to find the salary and name of the employees working
in any company placed in DELHI.
c. Write the expression to find the salary of the employees living in city MUMBAI
and working under the manager JOHN.
4. Consider the following three relations in a relational database.
Employee(eId,Name), Brand(bId,bName), Own(eId,bId)
Write the relational algebra expression that will return the set of eIds who own all
the brands. Write the equivalent tuple relational calculus and domain relational
calculus query.
5. Check whether the given schedules are conflict serializable or not-
a. S1: r1(x)r1(y)r2(x)r2(y)w2(y)w1(x)
b. S2: r1(x)r2(x)r2(y)w2(y)r1(y)w1(x)
Let ri(z) and wi(z) denote read and write operations respectively on a data
item z by a transaction Ti. Consider the following two schedules.
6. Check whether the given schedule S is conflict serializable and recoverable or not.
T1 T2 T3 T4
READ(X)
WRITE(X)
COMMIT
WRITE(X)
COMMIT
WRITE(Y)
READ(Z)
COMMIT
READ(X)
READ(Y)
COMMIT
Schedule S
7. Consider a schedule of transaction T1 and T2:
T1 RA RC WD WB Commit
T2 RB WB RD WC Commit
Here, RX stands for “Read(X)” and WX stands for “Write(X)”. Which one of the
following schedules is conflict equivalent to the above schedule?
(A)
T1 RA RC WD WB Commit
T2 RB WB RD WC Commit
(B)
T1 RA RC WD WB Commit
T2 RB WB RD WC Commit
8. Consider the following two transactions:
T1: read(A);
read(B);
if A = 0 then B := B + 1;
write(B).
T2: read(B);
read(A);
if B = 0 then A := A + 1;
write(A).
Add lock and unlock instructions to transactions T1 and T2, so that they observe the two-
phase locking protocol. Can the execution of these transactions result in a deadlock?
9. Check whether the given schedule below can complete all its operations in the given
order using timestamp based protocol or not.
T1 T2
READ(A)
READ(A)
WRITE (A)
WRITE(A)
10. Write down Two major differences between immediate and deferred database
modification.
******************************End*****************************