- SELECT t1.dept_name, count(t2.emp_id) AS total_employees
- FROM departments AS t1 LEFT JOIN employees AS t2
- ON t1.dept_id = t2.dept_id
- GROUP BY t1.dept_name
- HAVING total_employees = 0;
SQL Having Clause – MYsql Code |
---|
|
SQL Having Clause
|
Published: | September 28, 2020 |
Author: | admin |
Category: | SQL Advanced, SQL Source Code |
Views: | 19 |
This article was posted in SQL Advanced, SQL Source Code and tagged Exercise SQL Having Clause, How to write SQL Having Clause, SQL Having Clause - SQL Example. Bookmark the permalink. Follow comments with the RSS feed for this post.Post a Comment or leave a trackback: Trackback URL.
|
|