mysql not exists的语法,对比两种用法的差别
用exitst
select * from employees e
where not exists
(select emp_no from dept_emp d where d.emp_no = e.emp_no)
不用exists
select * from employees e
left join dept_emp d
on e.emp_no = d.emp_no
where d.emp_no is null
mysql not exists的语法,对比两种用法的差别
用exitst
select * from employees e
where not exists
(select emp_no from dept_emp d where d.emp_no = e.emp_no)
不用exists
select * from employees e
left join dept_emp d
on e.emp_no = d.emp_no
where d.emp_no is null