如何编写sql来显示不属于任何部门的员工人数?
怎么样?
select count(*) from employees where deptno is null;
这是基本过滤:
select count(*) cnt from employees where depno is null
这将为您提供未分配给部门的员工人数。如果要列出相应的行:
select * from employees where depno is null