query to find 2nd largest salary in sql

Solutions on MaxInterview for query to find 2nd largest salary in sql by the best coders in the world

showing results for - "query to find 2nd largest salary in sql"
Tina
14 May 2016
1/* sql 2nd highest salary employee */
2select sal, ename
3from emp
4where sal =
5    (
6        select max(sal) from emp where sal <
7            (select max(sal) from emp)
8    )
9----------------------------------------------- option 2
10select *
11from 
12(
13    select ename, sal, dense_rank() over(order by sal desc) rank
14    from emp
15)
16where rank =2;
Lara
23 Oct 2020
1SELECT MAX(SALARY) 'SECOND_MAX' FROM EMPLOYEES
2WHERE SALARY <> (SELECT MAX(SALARY) FROM EMPLOYEES);
3
4
5OR
6
7Here is the solution for nth highest
8salary from employees table 
9
10SELECT FIRST_NAME , SALARY FROM 
11(SELECT FIRST_NAME, SALARY, DENSE_RANK() OVER
12(ORDER BY SALARY DESC) AS SALARY_RANK
13FROM EMPLOYEES)
14WHERE SALARY_RANK = n; 
Eireann
17 Apr 2016
1SELECT MAX(salary) FROM Employee WHERE Salary NOT IN ( SELECT Max(Salary) FROM Employee);
queries leading to this page
find 2nd highest salary in sql using rownumsql query to find details of highest salaryhow to print highest salary in sqlsql query find second highest salaryhow to find second max salary in sqlfind the largest 7 th salary in sql queryhow to find second highest salary in sql using subquerysql query to find n highest salaryhow to get second highest salary using sql 2nd max salary in sqlget the 3rd highest salary sqlsql get time by second highest salarymysql query to get second highest salarysecond highest salary querysql query to find 5th highest salarysecond max salary in sql queryhow to find the third highest salary in sqlmax salary in sqlfind 4th highest salary in sqlhow to get second max salary in sqlwhat is the query to find second highest salary of employeedb query to find 2nd highest salarysql find third highest salaryhow to find last 2nd highest salary in sqlfind second max salary in sqlsecond highest salary also get other columns in sqlsql query for second largest salarysql query to find second max salarysql query for 2nd highest salarysql command for 2nd highest salarysecond highest salary in sql using limit2nd highest salary sql queryfind the 2nd max salary in sqlsql problem to find nth highest salaryhow to select 3rd highest salary in sqlwrite a sql query to get the second highest salary from employee tablequery to find the 2nd highest salarysecond highest from sqlsql second highest salary querywhat is the query for second highest salary in sql2nd highest salary query in sqlget the last thee max salaried person from table via sql sql query to find the 2nd highest salarywrite the sql command to fetch 2nd highest salary from the employee table query to find second highest salary of employeesql query to find second maximum salaryselect second highest salary sqlprint name of second highest salary in sqlhow to calculate the second highest salary in sqlwrite an sql query to find out the second highest salary from an employees table how to get the 2nd highest salary in sqlwrite sql query to get the second highest salary among all employeeswrite a sql query to print highest salary in 3 consecutive yearshow to get 2nd lowest salary in sqlget 3rd highest salary in sqlprint second and third highest salary in sqlwrite an sql query to find 2nd highest salary in the given table third highest salary sqlhow to add employee name and department name in this query select 28select max 28salary 29 from employee 29 max salary 2c 28select max 28salary 29 from employee where salary not in 28select max 28salary 29 from employee 29 29 as 2nd max salary 3bwrite a sql query for second highest salaryget 2nd highest salary from employee tablehow to find second highest salary in sql without using corelated queryfind third highest salary in sql serverhow to find the second highest number in sqlmysql get max salaryhow to get 3rd highest salary in sqlwrite a query to retrive 2nd highest salary from a table4th highest salary in sqlhow to get second maximum salary in sqlhighest salary in sqlquery for second highest salary in sqlhow to find the 3rd highest salary in sqlget second highest salarysql get third highest salarynth highest salary sql querysql query for third highest salaryselect name from emp where salary 3e 28select max 28salary 29 from emp where salary 3c 28select max 28salary 29 from emp 29 29 3bsql query to find 5th largest salary candidatefind the third highest salary in sqlselect 2nd max salary in sqlsql qury to get the second highest salaryfind top 2 salary sqlsql find 3rd highest salarysecond nth highest salary in sqlhighest second salary in sqlsql query to find employee who has second highest salaryhow to get second highest salary using limit in sqlwrite an sql query to show the second highest salary from a table how to print 2nd and 3rd highest salary in sqlwrite a sql query to get the second highest salary from the employee tableget 2nd highest salary in sqlselect max 28salary 29 as salary from employee where salary 3c 28select max 28salary 29 from employee 29 3b what is the output of this query 3fsql query to find third highest salary of employeeto second last highest salary in sqlsalary in my sqlhow would you find the second highest salary from the below table mysql 3fsecond height salary sqlsql query to find second highest salary 3fsecond maximum salary in sqlwrite an sql query to show the second highest salary from a tablesql queries for second highest salaryget highest salary in sqlsql query on finding the second highest salary from the employee table how to find a third and 6 highest salary in sql querysql query to get second highest salary using sub queryhow to get second highest salary in sqlsql query to select 2nd highest salaryfind the employee with the second highest salary using sql2nd and 3rd highest salary in sqlto find 2nd highest salary in sqlnth highest salary in sql using cteselect top 2nd highest salary for sqlsql query to find second highest salarythird highest or second highest salary queryget the second highest salary in sql secend highest salary sql queryget third highest salary in sqlnth highest salary in sqlhow do you 2nd highest salary in sqlfirst max salary in sqlfind second highest salary using limit in sqlsql query to find second highest salary of employeethird highest salary in sql using rownumhow to find the second biggest salary sqlhow to print 2nd highest salary in sqlhow to get third highest salary in sqlquery to find 2nd largest salary in sqlselect 2nd highest salary in sqlfourth highest salary in sqlhow to get the second highest salary in sqlsql query to find 2nd highest salary2nd highest salary in sqlsql query to find 2nd lowest salarygroup by in sql write the query for finding the second highest salaryq how to get the second highest salary using sql 3fsecond highest salary database queryselect second highest salary from each department sqlhow to calculate second max salary in sqlsecond highest salary in sql querythird highest salary in sqlhow to find the tenth highest salary in sqlsecond highest in sqlselect second highest salary from employee table 2nd highest salary sqlquery to get second highest salaryfind 2nd max salary in sqlsql 2nd highest salaryfind the second highest salary in sqlfind second max salary query sqlsql query for 2nd lowest salarysql second highest salary2nd maximum salary in sql emp tanleselect employee with second highest salary sqlsql 2bhighest salaryhow to find 2nd max salary in sqlfind 2nd highest salary in sqlhow to give find second highest salary in sql as second highest salarywhere salary 3d max 28salary 29 sqlhow to find employee who have the second highest salary in sqlfind second highest salary in sqlsecond largest salary in sqlget second highest salary in sql using ctehow to find the second highest salary in sql2 highest salary in sqlfirst highest salary in sqlsecond largest salary sql by maxsecond highest salary codesecond highest salary from salary colun sql commandfinding the third highest salary in sqlselect second highest salary in sqlsql second highest salary of employeesql select 2nd max salarysql highest salaryselect highest salary from table in sqldefine the second cte 2c itsalary 2c with the fields id and salary csdnhow to find second highest salary in sql using limitsql query for getting second highest salarysql find second highest salarysql third highest salaryselect highest salary in sql serversql query to find out highest salary from theget second highest salary from query sqlget second highest salary of a particular department sqlhow to find third max salary in sqlprint second highest salarysecond largest salary sqlwrite a sql query to find 2nd maximum salaryfinding second highest salary in sqlhow to find third highest salary in sql2nd max salary in mysqlfinding top2 nd highest salary in sqlhow to get 2nd highest salary in sql using joinselect top 2 salary from employee table2nd max element sql query2nd maximum salary in sql serverfind second largest salary sqlquery to get second max salaryhow to 2nd highest salary in sqlhow to give find second highest salary in sqlhighest second salary in sql using limitfind the person with 2nd highest salary sqlsql second highest salarywithot aggregatesql query to display second highest salaryhow to find the second maximum salary in sqlget second highest salary in sqlsecond maximum in sqlfind nth largest salary in sqlfind third highest salary and third lowest salary in sqlselect second highest salary in sql with other datasql command to find second highest salarysql select second highest salaryselect max 28salary 29 from employee where salary not in 28 select max 28salary 29 from employee 29 3bwrite a query to find the second max salarywrite a sql query to find the second highest salary from employees table n highest salary in sqlfind the second highest salary among the given table 28sql 29find second max salary in sql using limitsql query to get third highest salarysql second highest using fetchhow to find 2nd largest salary in sqlthird largest salary in sqlsql query to second highest salaryhow to find second highest salary in sql2nd highest salary in sql using limitfind second largest salary in sqlhow to find highest average in sqlsql query second highest salarysecond lowest salary in sqlsecond highest salary in sql serverhow to find the second max salary in sqlselect second max salary in sqlhow to get 2nd and rd highest salary in sqlquery to find 2nd highest salarylowest salary in sqltop 2nd highest salary in sql2nd largest salary in sqlfind third highest salary in sqlsql query for second highest salaryselect 2nd highest salary from employee table in sqlhow to set second largest salary in sqlsecond max salary in sqlfind second maximum salary in sqlto get second highest salary in sqlnth highest salary in sql serverorder by second highest salary in sqlfind the 2nd highest salary in sqlsql query to get the 3rd highest salaryhow to find highest salary in sqlsql server 2nd highest salaryselect max salary using top sqlgetting 4th highest salary in sqlsql query to query nth largest salaryhow to find second largest salary in sqlsql query to find the employee with the second highest salarysql query to find 2nd largest salary without using sub queryhow to get 2nd highest salary in sqlselect the highest salary in sql querysql query for 2nd max salarysql query to find the second highest salaryget 2nd hieghest salary of employee using sql query2nd max salary query in sqlhow to highest salary in sqlsecond highest salary insqlhow to find the 2nd highest salary in sql serverquery to find second highest salary2nd highest salary in sql practice2nd largest value in mysqlsecons hiest salary in sqlsql query highest salaryget second most highest salary sqlhighest salary in sqsecond highest salary employee sql2nd highest salary in each department sqlquery to find 3rd largest salary14th highest salary sqlwith the highest salaries sqlsql server second highest salarysql query to select second highest salaryselect nth highest salary in sqlhow to get 2nd highest salaries in sql 3fsql query to get second highest salaryfind out third highest salary in sqlfind 3rd highest salary in sqlsql query to find third highest salaryhow to query second lowest salary from employee table in sqlget second highest salary today in sqlhow to get second highest salary in each department in sqlwrite sql query to find second highest salary of employeesecond largest in sql querysecond highest salary my sqlsecond highest salary in sqlhow to find 2nd highest number in sqlsql query to show the second highest salary from a tablesecond highest salary sql serverhow to get highest salary in sqlcoderbyte mysql challenge mysql challenge 2c your query should return the informatioi for the employee with the third highest salary query for second highest salary3rd highest salary in sqlselect highest salary in sqlfind the 2nd largest salary in sqlhow to find the 2nd highest salary in sqlsql to find second highest salaryfind highest salary in each department sqlhow to get a second highest salary in sqlhighest nth salary in sqlquery second highest salary sqlsql query to find 2nd maximum salaryhow to find highest salary in sqlsql query to display 2nd highest salaried employee details and may ask for nth highestemployee second highest salary in sqlhow to display second highest salary in sqlfind second highest salary sqlwrite a sql query to get the second highest salary from the employee table ms sql server salary doublequery to select the emp of max salaryhow to pull 2nd maximum record sqlfind the second largest salary in sql queryfind 2nd largest 28salary 29 write the queryselect seceond higest query languagesql query to get second highest salary using rownumhow to select 2nd highest salary in sqlsql find second highest salary employeesql query to find out the second highest salary to get second max employee salary sql querycalculate second highest salary in sqlget second highest salary sqlhow to get second highest salary in sql for all employeet sql second highest salarysql query to return second highest salarygive second highest salary in sqlsql find second highestget second highest record in sqlsql get the second highest valuesql query to find third max salary2nd highest salary in sql 5csql query for find second highest salaryfind the nth highest salary in sqlhow to find second highest salary in sql without using subqueryin this mysql challenge 2c your query should return the informatioi for the employee with the third highest salary write a query that will find this employee and return that row 2c but then replace the di visionidfind second highest salary in sql using limithow to get 4th highest salary in sqlsecond highest salary sqlsql to find third highest salarygetting 3rd highest salary sqlget 2nd highest salary in sql serversql get second highest valuehow to get 2nd max salary in sqlnth highest salary sqlselect the 5 th highest salary in sqlprint second highest salary in sqlsecond highest salaryhow to find 3rd highest salary oehr in sqlsql query to find the second highest salary of employee 3ffind second highest salary in sql without subqueryhow to find 2nd highest salary in sqlquery to find 2nd largest salary in sql