select * from test1 where owner='SCOTT' or object_id in(select object_id from test2 where owner='SCOTT');
select * from test1 where owner='SCOTT'
union
select * from test1 where object_id in(select object_id from test2 where owner='SCOTT');
SELECT employee_id, first_name, last_name, salary
FROM employees a
WHERE salary = (SELECT MIN(salary)
FROM employees b
WHERE b.department_id = a.department_id);
with x as
(select e.*,min(salary) over (partition by e.department_id) as min_salary from employees e )
select employee_id, first_name, last_name, salary
from x where x.salary=x.min_salary;
转载于:https://blog.51cto.com/7642644/1785331