Hi Programmers,welcome to new article of ozanecare. this article i’ll write the queries to find out Salary less Than Average Salary in Microsoft SQL Server. let’s see the queries.



Directly Test Below Queries into Editor.
--Salary Less Than Average Salary
SELECT * FROM EMP E1,
(SELECT DEPTNO,AVG(SAL) AVG_SAL FROM EMP
GROUP BY DEPTNO) E2
WHERE E1.DEPTNO = E2.DEPTNO AND
E1.SAL < E2.AVG_SAL;
--To check all records from table
SELECT * FROM EMP;
--to find average salary
SELECT DEPTNO,AVG(SAL) AVG_SAL FROM EMP
GROUP BY DEPTNO
Happy Coding…Thanks.