TGViewer
Data Analytics Data Analytics @sqlspecialist ยท 111K subscribers
Post #2344 5.22K
๐Ÿ“Š ๐—œ๐—ป๐˜๐—ฒ๐—ฟ๐˜ƒ๐—ถ๐—ฒ๐˜„๐—ฒ๐—ฟ: How do you find Employees Earning More Than the Average Salary in SQL?

๐Ÿ™‹โ€โ™‚๏ธ ๐— ๐—ฒ: Use a subquery to calculate average salary first:

SELECT *
FROM employees
WHERE salary > (
SELECT AVG(salary)
FROM employees
);

๐Ÿง  Logic Breakdown:
- Inner query gets overall average salary
- Outer query filters employees earning more than that

โœ… Use Case: Performance reviews, salary benchmarking, raise eligibility

๐Ÿ’ก Pro Tip: Use ROUND(AVG(salary), 2) if you want clean decimal output.

๐Ÿ’ฌ Tap โค๏ธ for more!
  • โค 9
More from @sqlspecialist
  1. Oct 14, 2026I could then categorize customers into groups such as Active, At Risk, and Inactive and suโ€ฆ
  2. Oct 14, 2026๐Ÿ“Š Data Analyst Interview Series โ€” Part 10 Guys, let's continue our Data Analyst Interviewโ€ฆ
  3. Oct 13, 2026๐Ÿ“Š Data Analyst Interview Series โ€” Part 9 Guys, let's continue our Data Analyst Interviewโ€ฆ
  4. Oct 13, 2026๐—ง๐—ข๐—ฃ ๐—™๐—ฅ๐—˜๐—˜ ๐—–๐—ข๐—จ๐—ฅ๐—ฆ๐—˜๐—ฆ ๐—ง๐—ข ๐—•๐—ข๐—ข๐—ฆ๐—ง ๐—ฌ๐—ข๐—จ๐—ฅ ๐—ฆ๐—ž๐—œ๐—Ÿ๐—Ÿ๐—ฆ ๐—œ๐—ก ๐Ÿฎ๐Ÿฌ๐Ÿฎ๐Ÿฒ! Explorโ€ฆ
  5. Oct 12, 20268๏ธโƒฃ You receive a dataset with inconsistent date formats. How would you clean it? Sample Aโ€ฆ
  6. Oct 12, 2026๐Ÿ“Š Data Analyst Interview Series โ€” Part 7 Guys, let's continue our Data Analyst Interviewโ€ฆ
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook โ†’Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 โ†’