0

従業員部門スキーマから、各部門の詳細(部門 ID、部門名) と各部門の従業員数を取得する方法。

4

7 に答える 7

5

これを試して

select dept.deptId,
   deptName,
   count(emp.empid) as numb_of_emps
   from department dept inner join employee emp
   on dept.deptid = emp.deptid
   group by dept.deptid
于 2012-05-28T05:25:54.693 に答える
3

- (ラッセル・ディアスも示唆しているように)

select d.deptId,
       deptName,
       count(e.empid) "number of employees"
from department d, employee e
where d.deptid = e.deptid
group by d.deptid,d.deptname
于 2012-05-28T05:20:22.833 に答える
0

INNER JOIN を使用できます。

Select  e.EmployeeName,
        d.DepartmentName,
        count(d.DepId)As Total_no_of_Employees
From Department d
Inner join Employee e 
    On d.DepId = e.EmpID
Groub By DepartmentName, Total_no_of_Employees
于 2016-08-29T11:18:25.777 に答える
0
select d.deptno,dname,count(e.empno) "No of Emp"
from dept d, emp e 
where d.deptno = e.deptno
group by d.deptno,d.dname
于 2014-12-09T05:19:57.243 に答える
0
select d.deptno, d.dname, count(e.empno) "Number of employees"
from dept d, emp e
where d.deptno = e.deptno
group by d.deptno,d.dname;
于 2016-06-22T21:59:27.670 に答える