how to find max and min salary in sql 1

how to find max and min salary in sql

SELECT MAX(SALARY) FROM EMPLOYEES
UNION
SELECT MIN(SALARY) FROM EMPLOYEES;

Here is what the above code is Doing:
1. The first SELECT statement returns the maximum salary in the EMPLOYEES table.
2. The second SELECT statement returns the minimum salary in the EMPLOYEES table.
3. The UNION operator combines the results of the two SELECT statements.

Similar Posts