Assume I have the following table
id name city salary dept
and I want to select all salaries which are greater than the average salary
Assume I have the following table
id name city salary dept
and I want to select all salaries which are greater than the average salary
Following shall work for you.
SELECT salary FROM table_name WHERE salary > (SELECT AVG(salary) FROM table_name);
select e.employee_id, e.department_id, e.salary from employees e
where salary > (
select avg(salary)
from employees d where e.department_id =d.department_id)