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

COUNT() with GROUP BY and ORDER BY

Q:15
Display the total number of students in each batch in the descending order of total number.


SQL>  SELECT BRANCH, COUNT(*) "Number" FROM STUDENT GROUP BY BRANCH ORDER BY 2 DESC;

BRANCH                   Number
-------------------- ----------
SCIENCE                       3
HUMANITIES                    2
COMMERCE                      1