找不到。雇员/部门 [英] To find no. of employess/ Department

查看:78
本文介绍了找不到。雇员/部门的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有1个表名称Employee,列数为emp_id,姓名,薪水,部门



现在我必须找不到。每个部门的员工在升序中

i have 1 table name Employee with columns are emp_id,Name,Salary,Dept

Now i have to find no. of Employees per Department in Ascending Order

推荐答案

逻辑上查询将是..

Logically the query would be..
SELECT    Dept, COUNT(Dept) AS [Number of employees]
FROM      tbl_Employee
GROUP BY  Dept



但是,由于 sql 默认按升序排序,所以为了您的许可我在这里给出完整的查询:


But, as sql orders in ascending order by default so for your clearance i give the full query here:

SELECT     Dept, COUNT(Dept) AS [Number of employees]
FROM       tbl_Employee
GROUP BY   Dept
ORDER BY   Dept ASC


这篇关于找不到。雇员/部门的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆