Answers for "top 2 salary in sql"

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
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
-1

how to find top 3 salary in sql

SELECT salary, first_name, last_name FROM employees
ORDER BY salary DESC LIMIT 3;
Posted by: Guest on January-28-2021

Code answers related to "top 2 salary in sql"

Code answers related to "SQL"

Browse Popular Code Answers by Language