GATE DA 2026 | Question 60
Database Management and Warehousing › SQL · NAT · 2 marks · Answer: 3
- Question 60Database Management and Warehousingnat2 marksLet Account be a relation as shown.
Consider the given SQL query.Account AccNo Balance A1 5000 A2 5000 A3 10000 A4 15000 A5 18000The number of rows returned by the SQL query is __________ . (Answer in integer)sqlSELECT 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)Answer: 3
Solution
For each account, compare the number of higher balances with the number of lower balances:
Three rows are returned. Answer: 3.AccNo Balance higher lower higher >= lower? A1 5000 3 0 yes A2 5000 3 0 yes A3 10000 2 2 yes A4 15000 1 3 no A5 18000 0 4 no
More GATE PYQ on SQL
All GATE DA Database Management and Warehousing PYQ →Attempt GATE DA 2026 in real GATE exam mode
Full paper with a timer, the GATE interface and a topic-wise analysis — free.
Create free account →