What does the following subquery pattern do? SELECT * FROM employees WHERE salary > (SELECT AVG(salary) FROM employees)

SQL Data Analyst Medium

SQL Data Analyst — Medium

What does the following subquery pattern do? SELECT * FROM employees WHERE salary > (SELECT AVG(salary) FROM employees)

Key points

  • The subquery calculates the average salary of all employees
  • The main query filters employees based on their salary compared to the average
  • This pattern helps identify employees with above-average salaries

Ready to go further?

Related questions