Assignment 2 DBMS
Assignment 2 DBMS
b. Get supplier number who supply quantity greater than average quantity of
product no 20.
SELECT DISTINCT Sno
FROM SP
WHERE quantity > (SELECT AVG(quantity) FROM SP WHERE Pno = '20');
e. Get the name of all the suppliers whose city name starts with ‘A’ and ends with
‘B’
SELECT sname
FROM S
WHERE city LIKE 'A%B';
2. Consider a relation scheme R = (A, B, C, D, E, H) on which the following
functional dependencies hold: {A–>B, BC–> D, E–>C, D–>A}. What are the
candidate keys of R?
1. Date_of_Birth -> Age : This means that given someone's date of birth, you can
determine their age. It's a straightforward dependency.
2. Age -> Eligibility : This suggests that eligibility for something (probably a
particular program or service) is determined by age.
3. Name -> Roll_number : This means that given a person's name, you can determine
their roll number. This is common in academic contexts.
4. Roll_number -> Name : This is the inverse of the previous dependency, meaning
that given a roll number, you can determine the corresponding name.
5. Course_number -> Course_name : Given a course number, you can determine the
course's name.
4. 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.
S1 : r1(x) r1(y) r2(x) r2(y) w2(y) w1(x)
S2 : r1(x) r2(x) r2(y) w2(y) r1(y) w1(x)