Skip to content
Early access — you're among the first to try PYQLabs. Share feedback

SQL

GATE CSE & IT · 33 questions across 19 years (1998-2025) · 48% recurrence rate

Recurrence sparkline

19982025
199820122025

Difficulty mix

easy 36%
med 61%
hard 3%

Question types

MCQ25
OTHER3
NAT2
STMT2
MSQ1

All 33 questions on SQL

2025 PYQ

Consider the following relational schema: Students ($$\mathrm{\underline {rollno:integer}}$$, name: string, age: integer, cgpa: real) Courses ($$\mathrm{\underline {courseno:integer}}$$, cname: string, credits: integer)...

Med📊
2023 PYQ

Consider the following table named Student in a relational database. The primary key of this table is rollNum. Student rollNum name gender marks 1 Naman M 62 2 Aliya F 70 3 Aliya F 80 4 James M 82 5 Swati F 65 The SQL qu...

Easy
2021 PYQ

The relation scheme given below is used to store information about the employees of a company, where empId is the key and deptId indicates the department to which the employee is assigned. Each employee is assigned to ex...

Easy
2018 PYQ

Consider the following two tables and four queries in SQL. Book ( isbn , bname), Stock ( isbn , copies) Query 1: SELECT B.isbn, S.copies FROM Book B INNER JOIN Stock S ON B.isbn = S.isbn; Query 2: SELECT B.isbn, S.copies...

Easy
2016 PYQ

Consider the following database table named $$water$$_$$schemes :$$ water_schemes scheme_no district_name capacity 1 Ajmer 20 1 Bikaner 10 2 Bikaner 10 3 Bikaner 20 1 Churu 10 2 Churu 20 1 Dungargarh 10 The number of tup...

Med
2015 PYQ

Consider the following relation: Student Roll_No Student_Name 1 Raj 2 Rohit 3 Raj Performance Roll_No Course Marks 1 Math 80 1 English 70 2 Math 75 3 English 80 2 Physics 65 3 Math 80 Consider the following SQL query. SE...

Med
2015 PYQ

SELECT operation in SQL is equivalent to

Easy
2015 PYQ

Consider the following relation $$\,\,\,\,\,\,\,\,$$ Cinema(theater, address, capacity) Which of the following options will be needed at the end of the $$SQL$$ query $$\,\,\,\,\,\,\,\,$$ SELECT $$P1.$$address $$\,\,\,\,\...

Easy
2014 PYQ

Given the following statements: S1: A foreign key declaration can always be replaced by an equivalent check assertion in SQL. S2: Given the table R(a,b,c) where a and b together form the primary key, the following is a v...

Med
2014 PYQ

Consider the following relational schema: employee ( empId, empName, empDept ) customer ( custId, custName, salesRepId, rating) SalesRepId is a foreign key referring to empId of the employee relation. Assume that each em...

Med
2014 PYQ

Given the following schema: employees(emp-id, first-name, last-name, hire-date, dept-id, salary) departments(dept-id, dept-name, manager-id, location-id) You want to display the last names and hire dates of all latest hi...

Med
2014 PYQ

SQL allows duplicate tuples in relations, and correspondingly defines the multiplicity of tuples in the result of joins. Which one of the following queries always gives the same answer as the nested query shown below: Se...

Med
2012 PYQ

Which of the following statements are TRUE about an SQL query? P: An SQL query can contain a HAVING clause even if it does not have a GROUP BY clause Q: An SQL query can contain a HAVING clause only if it has a GROUP BY...

Med
2011 PYQ

Database table by name Loan_Records is given below. Borrower Bank_Manager Loan_Amount Ramesh Sunderajan 10000.00 Suresh Ramgopal 5000.00 Mahesh Sunderajan 7000.00 What is the output of the following SQL query? SELECT cou...

Med
2011 PYQ

Consider a database table T containing two columns X and Y each of type integer. After the creation of the table, one record (X = 1, Y = 1) is inserted in the table. Let MX and MY denote the respective maximum values of...

Easy
2010 PYQ

A relational schema for a train reservation database is given below: Passenger ( pid, pname, age) Reservation (pid, cass, tid) Table: Passenger pid pname age 0 'Sachin' 65 1 'Rahul' 66 2 'Sourav' 67 3 'Anil' 69 Table: Re...

Med
2008 PYQ

Consider The Following Relational Scheme Student ( school-id, sch-roll-no , sname, saddress) School ( school-id , sch-name, sch-address, sch-phone) Enrolment ( school-id, sch-roll-no, erollno, examname) ExamResult ( Erol...

Med
2007 PYQ

Consider the table employee(empId, name, department, salary) and the two queries Q 1 , Q 2 below. Assuming that department 5 has more than one employee, and we want to find the employees who get higher salary than anyone...

Med
2006 PYQ

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 i...

Med
2006 PYQ

Consider a database with three relation instances shown below. The primary keys for the Drivers and Cars relation are Did and cid respectively and the records are stored in ascending order of these primary keys as given...

Med
2006 PYQ

Consider the relation account (customer, balance) where customer is a primary key and there are no null values. We would like to rank customers according to decreasing balance. The customer with the largest balance gets...

Hard
2005 PYQ

In an inventory management system implemented at a trading corporation, there are several tables designed to hold all the information. Amongst these, the following two tables hold information on which items are supplied...

Med
2005 PYQ

The relation book (title, price) contains the titles and prices of different books. Assuming that no two books have the same price, what does the following SQL query list? Select title From book as B Where (select count(...

Med
2005 PYQ

A table ‘student’ with schema (roll, name, hostel, marks), and another table ‘hobby’ with schema (roll, hobbyname) contains records as shown below: Table: student Roll Name Hostel Marks 1798 Manoj Rathod 7 95 2154 Soumic...

Med
2004 PYQ

A relational database contains two table student and department in which student table has columns roll_no, name and dept_id and department table has columns dept_id and detp_name . the following insert statements were e...

Easy
2004 PYQ

Consider two tables in a relational database with columns and rows as follows: Table: Student Roll_no Name Dept_id 1 ABC 1 2 DEF 1 3 GHI 2 4 JKL 3 Table: Department Dept_id Dept_name 1 A 2 B 3 C Roll_no is the primary ke...

Med
2004 PYQ

The employee information in a company is stored in the relation Employee (name, sex, salary, deptName) Consider the following SQL query Select deptName From Employee Where sex = ‘M’ Group by deptName Having avg(salary) >...

Easy
2003 PYQ

Consider the set of relations shown 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...

Easy
2000 PYQ

Given relations r( w, x ) and s( y, z ), the result of select distinct w,x from r, s; is guaranteed to be same as r, provided

Easy
2000 PYQ

In SQL, relations can contain null values, and comparisons with null values are treated as unknown. Suppose all comparisons with a null value are treated as false. Which of the following pairs is not equivalent?

Med
1999 PYQ

Which of the following is/are correct?

Easy
1999 PYQ

Consider the set of relations EMP (Employee-no, Dept-no, Employee-name, Salary) DEPT (Dept-no, Dept-name, Location) Write an SQL query to: (a) Find all employee names who work in departments located at "Calcutta" and who...

Easy
1998 PYQ

Suppose we have a database consisting of the following three relations. FREQUENTS (student, parlor) giving the parlors each student visits. SERVES (parlor, ice-cream) indicating what kind of ice-creams each parlor serves...

Med