SQL (original) (raw)

**Table A:

Screenshot-2026-02-24-153509

**Table B:

Screenshot-2026-02-24-153536

Table C:

Screenshot-2026-02-24-153933

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")

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;

Database table by name Loan_Records is given below.

Screenshot-2026-02-24-161349

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 );

A relational schema for a train reservation database is given below. Passenger (pid, pname, age) Reservation (pid, class, tid)

**Table: Passenger

Screenshot-2026-02-24-164256

**Table : Reservation

Screenshot-2026-02-24-164523

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)

Let R and S be relational schemes such that R={a,b,c} and S={c}. Now consider the following queries on the database:

gateqa

IV) SELECT R.a, R.b
FROM R,S
WHERE R.c=S.c

Which of the above queries are equivalent?

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?

A library relational database system uses the following schema

USERS (User#, UserName, HomeTown) BOOKS (Book#, BookTitle, AuthorName) ISSUED (Book#, User#, Date)

Explain in one English sentence, what each of the following relational algebra queries is designed to determine

Consider the set of relations given below and the SQL query that follows

Students : (Roll number, Name, Date of birth)
Courses: (Course number, Course name, instructor)
Grades: (Roll number, Course number, Grade)
SELECT DISTINCT Name
FROM Students, Courses, Grades
WHERE Students.Roll_number = Grades.Roll_number
AND Courses.Instructor =Sriram
AND Courses.Course_number = Grades.Course_number
AND Grades.Grade = A

Which of the following sets is computed by the above query?

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?

Which of the following is true ? I. Implementation of self-join is possible in SQL with table alias. II. Outer-join operation is basic operation in relational algebra. III. Natural join and outer join operations are equivalent.

There are 66 questions to complete.

Take a part in the ongoing discussion