Question 1
Table A:

Table B:

Table C:

Consider the above tables A, B and C. How many tuples does the result of the following SQL query contains?
SELECT A.id
FROM A
WHERE A.age > ALL (SELECT B.age
FROM B
WHERE B. name = "arun")
4
3
0
1
Question 2
A table T(X, Y) initially has one record (1, 1). New records are inserted 128 times with:
X = MX + 1, Y = 2*MY + 1
where MX and MY are the current maximums of X and Y.What will MAX(X) and MAX(Y) be after all insertions?
SELECT Y FROM T WHERE X=7;127
255
129
257
Question 3
Database table by name Loan_Records is given below.

What is the output of the following SQL query?
SELECT Count(*)
FROM ( ( SELECT Borrower, Bank_Manager
FROM Loan_Records) AS S
NATURAL JOIN ( SELECT Bank_Manager, Loan_Amount
FROM Loan_Records) AS T );3
9
5
6
Question 4
A relational schema for a train reservation database is given below. Passenger (pid, pname, age) Reservation (pid, class, tid)
Table: Passenger

Table : Reservation

What pids are returned by the following SQL query for the above instance of the tables?
SLECT pid
FROM Reservation ,
WHERE class ‘AC’ AND
EXISTS (SELECT *
FROM Passenger
WHERE age > 65 AND
Passenger. pid = Reservation.pid)1, 0
1, 2
1, 3
1, 5
Question 5
Consider the following relational schema:
Suppliers(sid:integer, sname:string, city:string, street:string)
Parts(pid:integer, pname:string, color:string)
Catalog(sid:integer, pid:integer, cost:real)
Consider the following relational query on the above database:
SELECT S.sname
FROM Suppliers S
WHERE S.sid NOT IN (SELECT C.sid
FROM Catalog C
WHERE C.pid NOT IN (SELECT P.pid
FROM Parts P
WHERE P.color<> 'blue'))
Assume that relations corresponding to the above schema are not empty. Which one of the following is the correct interpretation of the above query?
Find the names of all suppliers who have supplied a non-blue part.
Find the names of all suppliers who have not supplied a non-blue part.
Find the names of all suppliers who have supplied only blue parts.
Find the names of all suppliers who have not supplied only blue parts.
Question 6
Consider the following relational schema:
Suppliers(sid:integer, sname:string, city:string, street:string)
Parts(pid:integer, pname:string, color:string)
Catalog(sid:integer, pid:integer, cost:real)
Assume that, in the suppliers relation above, each supplier and each street within a city has a unique name, and (sname, city) forms a candidate key. No other functional dependencies are implied other than those implied by primary and candidate keys. Which one of the following is TRUE about the above schema?
The schema is in BCNF
The schema is in 3NF but not in BCNF
The schema is in 2NF but not in 3NF
The schema is not in 2NF
Question 7
Consider a relation geq which represents “greater than or equal to”, that is, (x,y) ∈ geq only if y >= x.
create table geq
(
ib integer not null
ub integer not null
primary key 1b
foreign key (ub) references geq on delete cascade
)
Which of the following is possible if a tuple (x,y) is deleted?
A tuple (z,w) with z > y is deleted
A tuple (z,w) with z > x is deleted
A tuple (z,w) with w < x is deleted
The deletion of (x,y) is prohibited
Question 8
Insert into department values (1, 'Mathematics')
Insert into department values (2, 'Physics')
Insert into student values (l, 'Navin', 1)
Insert into student values (2, 'Mukesh', 2)
Insert into student values (3, 'Gita', 1)
How many rows and columns will be retrieved by the following SQL statement?
Select * from student, department0 row and 4 columns
3 rows and 4 columns
3 rows and 5 columns
6 rows and 5 columns
Question 9
Select operation in SQL is equivalent to
the selection operation in relational algebra
the selection operation in relational algebra, except that select in SQL retains duplicates
the projection operation in relational algebra
the projection operation in relational algebra, except that select in SQL retains duplicates
Question 10
Consider the relation "enrolled(student, course)" in which (student, course) is the primary key, and the relation "paid(student, amount)" where student is the primary key. Assume no null values and no foreign keys or integrity constraints. Given the following four queries:
Query1: select student from enrolled where
student in (select student from paid)
Query2: select student from paid where
student in (select student from enrolled)
Query3: select E.student from enrolled E, paid P
where E.student = P.student
Query4: select student from paid where exists
(select * from enrolled where enrolled.student
= paid.student)
Which one of the following statements is correct?
All queries return identical row sets for any database
Query2 and Query4 return identical row sets for all databases but there exist databases for which Query1 and Query2 return different row sets.
There exist databases for which Query3 returns strictly fewer rows than Query2
There exist databases for which Query4 will encounter an integrity violation at runtime.
There are 34 questions to complete.