---
title: "How do you select employees whose salary is above the average salary of their department?"  
description: "How do you select employees whose salary is above the average salary of their department?"  
author: "Ashutosh Patel"  
published: 2025-04-30  
updated: 2025-05-03  
canonical: https://www.mindstick.com/forum/161556/how-do-you-select-employees-whose-salary-is-above-the-average-salary-of-their-department  
category: "SQL Server"  
tags: ["mssql server", "sql server", "SQL Database"]  
reading_time: 2 minutes  

---

# How do you select employees whose salary is above the average salary of their department?

How do you [select](https://www.mindstick.com/forum/160534/orderby-then-select-vs-select-then-orderby-performance) employees whose salary is above the [average salary](https://answers.mindstick.com/qa/33692/what-is-the-average-salary-of-an-indian-news-anchor-and-editors) of their department?

## Replies

### Reply by Khushi Singh

To find [employees](https://www.mindstick.com/articles/338656/the-science-behind-employee-recognition-why-it-matters) whose salary is above the average for their department, you can use a correlated subquery in [SQL.](https://www.mindstick.com/articles/12525/indexes-in-sql-server) This type of subquery checks each employee’s salary against the average salary calculated for their specific department. It runs for each employee in the main query, allowing a focused comparison based on department averages.

Here's how it works: for each employee in the Employees table, we compare their salary to the average salary of everyone in their department. If their salary is higher, they show up in the results.

Let’s say the Employees table has these columns: EmployeeID, Name, DepartmentID, and Salary.

The SQL query would look like this:

```plaintext
SELECT EmployeeID, Name, DepartmentID, Salary
FROM Employees E
WHERE Salary > (
   SELECT AVG(Salary)
   FROM Employees
   WHERE DepartmentID = E.DepartmentID
);
```

In this example, the main query selects employee info, while the subquery figures out the average salary for that employee’s department (E.DepartmentID). Since the subquery refers to a column from the main query, it calculates the average for each department separately.

This approach makes sure we only compare each employee's salary to their department's average, not the whole company’s average. It’s a straightforward way to pick out top earners within each department, which can help with performance assessments, pay reviews, or decisions about promotions.


---

Original Source: https://www.mindstick.com/forum/161556/how-do-you-select-employees-whose-salary-is-above-the-average-salary-of-their-department

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
