|
- SELECT employee_id,salary,last_name FROM employees M
- WHERE EXISTS
- (SELECT 'X' FROM employees W
- WHERE (W.manager_id=M.employee_id) AND W.salary > 10000);
- SELECT employee_id,salary,last_name FROM employees M
- WHERE employee_id in
- (SELECT W.manager_id FROM employees W
- WHERE (W.manager_id=M.employee_id) AND W.salary > 10000);
- SELECT employee_id,salary,last_name FROM employees M
- WHERE employee_id in
- (SELECT manager_id FROM employees
- WHERE salary > 10000);
- SELECT * FROM departments
- WHERE NOT EXISTS
- (SELECT * FROM employees
- WHERE employees.department_id=departments.department_id);
- SELECT * FROM departments
- WHERE not exists
- (SELECT 'X' FROM employees
- WHERE employees.department_id=departments.department_id);
- SELECT * FROM departments
- where department_id not in
- (select department_id from employees where department_id is not null );
复制代码
|
|