GATE DA 2025 Set 1 — Question 33
Go beyond PYQs with Success TrackerAI-powered personalised practice and doubt support. Unlimited practice on eligible plans; AI usage limits apply.NAT+1 / -0EasyAggregate FunctionsSQLDatabase Management & WarehousingFiltering, Grouping & Nested Queries
Database Management & Warehousing → SQL → Aggregate Functions
Last updated
Question
On a relation named Loan of a bank:Loan
the following SQL query is executed.The number of rows returned by the query is ______________ (Answer in integer)
| loan_number | branch_name | amount |
|---|---|---|
| L11 | Banjara Hills | 90000 |
| L14 | Kondapur | 50000 |
| L15 | SR Nagar | 40000 |
| L22 | SR Nagar | 25000 |
| L23 | Balanagar | 80000 |
| L25 | Kondapur | 70000 |
| L19 | SR Nagar | 65000 |
SELECT L1.loan_number
FROM Loan L1
WHERE L1.amount > (SELECT MAX (L2.amount)
FROM Loan L2
WHERE L2.branch_name = 'SR Nagar');
Correct answer
3 to 3
Solution
The query consists of an outer query and a subquery.Step 1: Evaluate the subquery
Filter rows where
So, the subquery returns 65000.Step 2: Evaluate the outer query
Check each row in the Loan table:
The number of rows returned is 3.
SELECT MAX (L2.amount)
FROM Loan L2
WHERE L2.branch_name = 'SR Nagar'
Filter rows where
branch_name is 'SR Nagar':- L15: 40000
- L22: 25000
- L19: 65000
So, the subquery returns 65000.Step 2: Evaluate the outer query
SELECT L1.loan_number
FROM Loan L1
WHERE L1.amount > 65000
Check each row in the Loan table:
- L11: 90000 > 65000 (True)
- L14: 50000 > 65000 (False)
- L15: 40000 > 65000 (False)
- L22: 25000 > 65000 (False)
- L23: 80000 > 65000 (True)
- L25: 70000 > 65000 (True)
- L19: 65000 > 65000 (False)
The number of rows returned is 3.
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…