GATE DA 2025 · SQL Queries

NAT · 1 mark · Problem DBMS-SQL-0040

On a relation named Loan of a bank:\[\begin{array}{c} \textbf{Loan}\\ \begin{array}{|c|c|c|} \hline \text{loan number} & \text{branch name} & \text{amount} \\ \hline L11 & \text{Banjara Hills} & 90000 \\ \hline L14 & \text{Kondapur} & 50000 \\ \hline L15 & \text{SR Nagar} & 40000 \\ \hline L22 & \text{SR Nagar} & 25000 \\ \hline L23 & \text{Balanagar} & 80000 \\ \hline L25 & \text{Kondapur} & 70000 \\ \hline L19 & \text{SR Nagar} & 65000 \\ \hline \end{array}\end{array}\]The following SQL query is executed:
SELECT L1.loan number
 FROM Loan L1
 WHERE L1.amount >(SELECT MAX(L2.amount)
 FROM Loan L2
 WHERE L2.branch name='SR Nagar');
The number of rows returned by the query is (Answer in integer)

Numerical answer (NAT).

Solve it on GATE DA practice →More Relational Model & SQL problems

Show the worked solutionInner subquery: \(\text{MAX(amount)}\) for \(\text{branch\_name='SR Nagar'}\) — SR Nagar loans are \(L15\ (40000)\), \(L22\ (25000)\), \(L19\ (65000)\). Maximum \(=65000\).Outer query: loans with \(\text{amount}>65000\) (strictly greater): \(L11\ (90000)\) ✓, \(L14\ (50000)\), \(L15\ (40000)\), \(L22\ (25000)\), \(L23\ (80000)\) ✓, \(L25\ (70000)\) ✓, \(L19\ (65000,\text{not}>65000)\).Qualifying loans: \(L11, L23, L25\) — \(3\) rows.Answer: 3Click Here for Detail SolutionGateOverflow discussion: https://gateoverflow.in/460999/gate-da-2025-question-23

GATE DA practice: past exam problems by chapter, with worked solutions · gatedaprep.com