mysql3 列出最低薪金大于1500的各种工作及从事此工作的员工人数。4 列出部门名称和这些部门的员工信息同时列出那些没有员工的部门5 查询部门编号、部门名称、部门位置、部门人数。
- To list the various jobs with a minimum salary greater than 1500 and the number of employees working in each job:
SELECT job_title, COUNT(*) AS employee_count
FROM employees
JOIN jobs ON employees.job_id = jobs.job_id
WHERE jobs.min_salary > 1500
GROUP BY job_title;
- To list the department names and their employee information, including departments without employees:
SELECT departments.department_name, employees.*
FROM departments
LEFT JOIN employees ON departments.department_id = employees.department_id;
- To query the department number, department name, department location, and the number of employees in each department:
SELECT department_id, department_name, location_id, COUNT(*) AS employee_count
FROM employees
GROUP BY department_id, department_name, location_id;
``
原文地址: http://www.cveoy.top/t/topic/hAfy 著作权归作者所有。请勿转载和采集!