Answers for "second highest salary in mysql"

SQL
3

sql select second max

Both options you find max as a subset and then exclude from main select
sql> SELECT MAX( col ) FROM table
 	WHERE col < ( SELECT MAX( col ) FROM table);
sql> SELECT MAX(col) FROM table 
WHERE col NOT IN (SELECT MAX(col) FROM table);
Posted by: Guest on February-08-2020
2

2nd highest salary in mysql

#2nd Most highest salary using Limit & Order By
SELECT Salary FROM (SELECT Salary FROM Employee ORDER BY salary DESC LIMIT 2) AS Emp ORDER BY salary LIMIT 1;
Posted by: Guest on November-06-2020
0

how to find 2nd highest salary in mysql

#2nd Most highest salary using Group By, Order By & Limit clause
SELECT sal FROM emp GROUP BY sal ORDER BY sal DESC LIMIT 1, 1;
Posted by: Guest on April-09-2021
0

how to find 2nd highest salary in mysql

#2nd Most highest salary using dense_rank()
SELECT sal 
FROM (SELECT dense_rank() over(ORDER BY sal DESC) AS R, sal FROM emp) employee 
WHERE R = 2;
Posted by: Guest on April-09-2021
0

sql highest salary by location

/*  Highest salary by Department/Location   */
SELECT e.ename, e.sal, e.deptno, d.loc
FROM emp e
JOIN dept d
ON e.deptno = d.deptno
WHERE e.sal in
( 	
  	select max(sal) 
  	from emp 
  	group by deptno
)
Posted by: Guest on June-28-2020
0

how to get employee having maximum experience in mysql

select max(salary), dept_id from employee where salary not in(select max(salary) from employee) group by dept_id;
Posted by: Guest on November-02-2020

Code answers related to "second highest salary in mysql"

Code answers related to "SQL"

Browse Popular Code Answers by Language