SQL Exercises: Find the number of employees in each department along with the department code
SQL Aggregate Functions: Exercise-25 with Solution
Write a query in SQL to find the number of employees in each department along with the department code.
Sample table: emp_details
SELECT emp_dept, COUNT(*) FROM emp_details GROUP BY emp_dept;
Output of the Query:
emp_dept count 27 2 57 5 47 3 63 3
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
What is the difficulty level of this exercise?
- New Content published on w3resource:
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework