SQL: GATE CS Previous Year Questions

SQL · Databases

43 questions · asked in 23 of 27 years (2000–2026)

MCQ 34 · MSQ 1 · NAT 81-mark 26 · 2-mark 17

2000Questions per year2026

Questions 11–15 of 43

Q11GATE 2016 (Session 2)2 marksNAT
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 tuples returned by the following SQL query is __________.
with total(name, capacity) as
    select district_name, sum(capacity)
    from water_schemes
    group by district_name
with total_avg(capacity) as
    select avg(capacity)
    from total
select name
    from total, total_avg
    where total.capacity ≥ total_avg.capacity

Q12GATE 2015 (Session 1)1 markMCQ−0.33 if wrong
SELECT operation in SQL is equivalent to

Q13GATE 2015 (Session 1)2 marksNAT
Consider the following relations:
Student Performance Roll_No Student_Name 1Raj 2Rohit 3Raj Roll_No Course Marks 1Math80 1English70 2Math75 3English80 2Physics65 3Math80
Consider the following SQL query.
SELECT S.Student_Name, sum(P.Marks)
FROM Student S, Performance P
WHERE S.Roll_No = P.Roll_No
GROUP BY S.Student_Name

The number of rows that will be returned by the SQL query is _____________.

Q14GATE 2015 (Session 3)1 markMCQ−0.33 if wrong
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 FROM Cinema P1

such that it always finds the addresses of theaters with maximum capacity?

Q15GATE 2014 (Session 1)1 markMCQ−0.33 if wrong
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 valid table definition.
CREATE TABLE S (
a INTEGER,
d INTEGER,
e INTEGER,
PRIMARY KEY (d),
FOREIGN KEY (a) references R)
Which one of the following statements is CORRECT?

Keep practising

Topics in Databases

All CS topics ›