programming-examples/sql/JoinHRDatabase/15. Write a query in SQL to display the name of the department, average salary and number of employees working in that department who got commission.sql

6 lines
319 B
MySQL
Raw Normal View History

2019-11-18 14:05:53 +01:00
/*15. Write a query in SQL to display the name of the department, average salary and number of employees working in that
department who got commission.*/
SELECT department_name, AVG(salary), COUNT(commission_pct)
FROM departments
JOIN employees USING (department_id)
GROUP BY department_name;