SELECT DeptName , COUNT(*) AS "DeptNumberCount" FROM Department GROUP BY DeptName
This is the code i’m running that im working on for SQL but i’m trying to get the count to show up first then the deptname, but it doesn’t allow me to and i need to have it so it’s largest to smallest.
Can someone please help
I’ve tried putting:
GROUP BY "DeptNumberCount" , DeptName or GROUP BY DeptNumberCount , DeptName
HAVING clause is giving me a syntax
Try ordering descending by the department count:
SELECT COUNT(*) AS "DeptNumberCount", DeptName FROM Department GROUP BY DeptName ORDER BY COUNT(*) DESC;