Answers for "2nd max salary query in sql"

SQL
1

second max salary in sql

SELECT MAX(SALARY) 'SECOND_MAX' FROM EMPLOYEES
WHERE SALARY <> (SELECT MAX(SALARY) FROM EMPLOYEES);
Posted by: Guest on November-27-2020
0

second highest salary in sql

SELECT MAX(SALARY) 'SECOND_MAX' FROM EMPLOYEES
WHERE SALARY <> (SELECT MAX(SALARY) FROM EMPLOYEES);


OR

Here is the solution for nth highest
salary from employees table 

SELECT FIRST_NAME , SALARY FROM 
(SELECT FIRST_NAME, SALARY, DENSE_RANK() OVER
(ORDER BY SALARY DESC) AS SALARY_RANK
FROM EMPLOYEES)
WHERE SALARY_RANK = n;
Posted by: Guest on January-07-2021
1

query to find 2nd largest salary in sql

SELECT MAX(salary) FROM Employee WHERE Salary NOT IN ( SELECT Max(Salary) FROM Employee);
Posted by: Guest on April-09-2021
0

2nd max salary query in sql

select *from employee 
group by salary 
order by  salary desc limit 1,1;
Posted by: Guest on September-06-2021

Code answers related to "2nd max salary query in sql"

Code answers related to "SQL"

Browse Popular Code Answers by Language