GATE / CS ARCHIVE

GATE CSE 2015 SET 3 / QUESTION 29

GATE CSE 2015 Set 3 Q29

Database Management Systems · SQL & Queries · Full GATE CSE 2015 Set 3 paper

GATE 2015 Set 3, Q29 1 mark · MCQ
Report issue

SQL & Queries

Question 29, GATE 2015: For Cinema(theater,address,capacity), append a condition to SELECT P1.address FROM Cinema P1 so that it returns addresses of theaters having maximum capacity. Options: (A) WHERE P1.capacity >= ALL (SELECT P2.capacity FROM Cinema P2); (B) WHERE P1.capacity >= ANY (SELECT P2.capacity FROM Cinema P2); (C) WHERE P1.capacity > ALL (SELECT MAX(P2.capacity) FROM Cinema P2); (D) WHERE P1.capacity > ANY (SELECT MAX(P2.capacity) FROM Cinema P2). Explain the ordinary nonnull-capacity assumption.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

Our answer: A for nonnull capacities

1. P1.capacity≥ALL capacities selects exactly maximal capacities, including ties, A.

2. ANY admits smaller nonmaximal values, and strictly greater than MAX admits none. This assumes capacities are nonnull: a NULL in the subquery can make ALL unknown even for a maximum; a NULL-safe implementation filters null capacities or compares to MAX.

Original paper, page 62 · Answer key