问题描述:使用含有关键字exists查找未分配具体部门的员工的所有信息。
解答:

SELECT e.*
FROM employees e
WHERE NOT EXISTS (SELECT * FROM dept_emp d
                  WHERE d.emp_no = e.emp_no);

不使用exists(不符合题意,仅作为拓展):
方案1:联结dept_emp,employees表,where过滤条件为d.dept_no = NULL的记录

SELECT e.*
FROM employees e
LEFT JOIN dept_emp d
ON e.emp_no = d.emp_no
WHERE d.dept_no IS NULL;

方案2:使用where子查询过滤emp_no

SELECT * 
FROM employees
WHERE emp_no NOT IN (SELECT emp_no FROM dept_emp);

有关谓词EXIST的补充:

作用;判断是否存在某种条件的记录,如果存在这种记录就返回TRUE,否则返回FALSE.相当于IN。NOT EXISTS 相当于NOT IN

写法:通常在where子句中,右侧书写一个参数,通常为子查询,左侧无参数

select *
from t1
where exists (select * from t2 where t1.column = t2.column)

子查询中的select子句不一定非要她t2表格中存在的列,常数1,2,3也可以。
像本题,以下两段代码的作用一样

SELECT e.*
FROM employees e
WHERE NOT EXISTS (SELECT * FROM dept_emp d
                  WHERE d.emp_no = e.emp_no);
SELECT e.*
FROM employees e
WHERE NOT EXISTS (SELECT 1 FROM dept_emp d
                  WHERE d.emp_no = e.emp_no);

因为exists子查询返回的是TRUE or FALSE的记录。
更多关于谓词exists的内容请查看官方文档:
https://dev.mysql.com/doc/refman/8.0/en/exists-and-not-exists-subqueries.html