I am stuck in a query, my query is as follow:
SELECT department_name AS 'Department Name', COUNT(*) AS 'No of Employees' FROM departments INNER JOIN employees ON employees.department_id = departments.department_id GROUP BY departments.department_id, department_name
ORDER BY COUNT(*) DESC;
this query is giving me results as in below attachment
What i want now is to sort the departments alphabetically if two or more department have same number of students. e.g "Purchasing" and "Finance" should be sort alphabetically.
You can try this query in the following link: