GATE DA 2026 Set 1 — Question 60
Go beyond PYQs with Success TrackerAI-powered personalised practice and doubt support. Unlimited practice on eligible plans; AI usage limits apply.NAT+2 / -0MediumFiltering, Grouping & Nested QueriesSQLDatabase Management & WarehousingAggregate Functions
Database Management & Warehousing → SQL → Aggregate Functions
Last updated
Question
Let Account be a relation as shown.Account
Consider the given SQL query.The number of rows returned by the SQL query is __________ . (Answer in integer)
| 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)
Correct answer
3 to 3
Solution
The SQL query selects rows from the
Account table where the number of accounts with a strictly higher balance is greater than or equal to the number of accounts with a strictly lower balance.Let's evaluate the condition for each row in the table:1.For A1 (Balance = 5000):
count_greater(B.Balance > 5000): A3 (10000), A4 (15000), A5 (18000) Count = 3count_smaller(C.Balance < 5000): None Count = 0- Condition: is True. (Row A1 is selected)
count_greater(B.Balance > 5000): A3 (10000), A4 (15000), A5 (18000) Count = 3count_smaller(C.Balance < 5000): None Count = 0- Condition: is True. (Row A2 is selected)
count_greater(B.Balance > 10000): A4 (15000), A5 (18000) Count = 2count_smaller(C.Balance < 10000): A1 (5000), A2 (5000) Count = 2- Condition: is True. (Row A3 is selected)
count_greater(B.Balance > 15000): A5 (18000) Count = 1count_smaller(C.Balance < 15000): A1 (5000), A2 (5000), A3 (10000) Count = 3- Condition: is False.
count_greater(B.Balance > 18000): None Count = 0count_smaller(C.Balance < 18000): A1 (5000), A2 (5000), A3 (10000), A4 (15000) Count = 4- Condition: is False.
Continue learning with Success Tracker
A step still unclear? Work through it with support
Use Success Tracker to ask about the reasoning, then try another GATE DA question to check your understanding.
AI-powered practice· Unlimited practice on eligible plans
- PYQs with solutions
- Attempt available previous-year questions, then compare your reasoning with the worked solution. Coverage varies by stream.
- Practice that adapts
- Choose a topic, work on weaker areas and bookmark questions to revisit. Your attempts feed your progress tracking.
- AI doubt support
- Ask follow-up questions about a step or concept while practising, instead of stopping at the final answer.
Unlimited practice is available on eligible plans. Free practice and AI usage have limits; check the current plan allowances before choosing.
This page stays readable without an account. AI responses can be wrong; check them against the solution and source material.
More questions on SQL
2026 Set 1 Q17 be a relational schema with functional dependency set…2026 Set 1 Q18Consider that the visualization of a 3-dimensional data cube is showing Sales Quantity for each…2026 Set 1 Q26Consider two relations r and s defined on the relational schemas R(A,B) and S(E,C), respectively. A…2026 Set 1 Q32In a relational database, a B+ Tree Index is to be constructed for a relation on a key field. In a…2026 Set 1 Q41Consider a B+ Tree where the maximum number of key values in each leaf node is 2 and the maximum…