I am currently in Correlated Subqueries chapter of SQL and both of the following code is giving same result, i wanted to know whether that stands true in all the scenarios or functioning of both the functions are different.
query question - select employees from each office_id, whose salary more than the avg of the salary of the all the employees in that office_id
select *
from employees
Where salary >= ALL (
select avg(salary)
from employees
group by office_id
)
OR
select *
from employees e
Where salary > (
select avg(salary)
from employees
Where office_id = e.office_id