如何显示不属于部门的员工SQL

问题描述

如何编写sql显示不属于任何部门的员工人数?

enter image description here

解决方法

怎么样?

select count(*)
from employees
where deptno is null;
,

这是基本过滤:

select count(*) cnt
from employees
where depno is null

这将为您提供未分配给部门的员工人数。如果要列出相应的行:

select *
from employees
where depno is null