Query Employees With Above Average Salary

Find employees whose salary is greater than the average salary of the entire company.

sql

SELECT id, name, salary FROM employees WHERE salary > (SELECT AVG(salary) FROM employees);

This query uses a subquery to calculate the average salary of all records in the "employees" table and filters the result set to return only those employees whose salary exceeds that calculated value.

PromptDB can make mistakes. Please double-check responses.