GATE DA 2026 Q60: Rows returned by a correlated count comparison
- Database Management and Warehousing
- 2 marks
- NAT
- No negative marking
Question
Let Account be a relation as shown.
| AccNo | Balance |
|---|---|
| A1 | 5000 |
| A2 | 5000 |
| A3 | 10000 |
| A4 | 15000 |
| A5 | 18000 |
SELECT AccNo FROM Account AS A
WHERE (SELECT COUNT(*) FROM Account AS B
WHERE A.Balance < B.Balance) >= (SELECT COUNT(*)
FROM Account AS C WHERE A.Balance > C.Balance)Consider the SQL query above. The number of rows returned by the SQL query is __________. (Answer in integer)
Try it: numerical answer: type the value
Numerical answer. No negative marking.
Show answer and explanation
Answer: 3 (official GATE 2026 final answer key)
Concept used: Correlated subqueries: for each account, compare how many balances are higher with how many are lower.
First step: A1, A2: 3 higher, 0 lower; A3: 2 higher, 2 lower; A4: 1 higher, 3 lower; A5: 0 higher, 4 lower.
Full step-by-step solution
Detailed working, common mistakes and linked mock tests will be available with a free GATEiit account. Log-in is coming soon.
Share this question
Source: official GATE 2026 DA question paper and final answer key, organised by IIT Guwahati. Question paper · Answer key
More Database Management and Warehousing PYQs
- 2026 · Q17Candidate keys from functional dependencies
- 2026 · Q18OLAP operation from Country to State
- 2026 · Q26Operations that never violate a foreign key
- 2026 · Q32Order of a B+ tree non-leaf node
- 2026 · Q41B+ tree root after inserting 3
- 2026 · Q42Output of a relational algebra expression with natural joins