Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/lsp4you/public_html/connect.php on line 2 LSP4YOU - Learner's Support Publications

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