Nested Query

Q:12
Display the name of customers with maximum deposit in each branch.


SQL> SELECT NAME, BRANCH, AMOUNT FROM DEPOSIT WHERE AMOUNT IN (
  2  SELECT MAX(AMOUNT) FROM DEPOSIT GROUP BY BRANCH);

NAME                      BRANCH                   AMOUNT
------------------------- -------------------- ----------
RAM KUMAR                 COCHIN                    25000
KRISHNA KUMAR             TRICHUR                   45000
DEVA KUMAR                CALICUT                   60000