how to find max and min salary in sql code example

Example 1: min and max salary and name in sql

SELECT FIRST_NAME , SALARY
FROM EMPLOYEES
WHERE SALARY IN (SELECT MAX(SALARY)AS RESULT FROM EMPLOYEES
UNION
SELECT MIN(SALARY)AS RESULT FROM EMPLOYEES);

Example 2: how to find max and min salary in sql

SELECT MAX(salary), MIN(salary) FROM employees;

Example 3: how to find max and min salary in sql

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

Example 4: max 3 salary in sql

SELECT salary, first_name, last_name FROM employees
ORDER BY salary DESC LIMIT 3;

Tags:

Misc Example