Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...


how to find the second highest salary from emp table?

Answers were Sorted based on User's Feedback



how to find the second highest salary from emp table?..

Answer / winnie

select max(sal) from emp
where sal not in (select max(sal) from emp )

Is This Answer Correct ?    1083 Yes 130 No

how to find the second highest salary from emp table?..

Answer / gayathri

select max(salary ) from emp table where sal<(select max
(salary)from emp table)

Is This Answer Correct ?    749 Yes 97 No

how to find the second highest salary from emp table?..

Answer / bipin

use this query. it works great.

select max(sal) from table_name where sal<(select max(sal)
from table_name)

Is This Answer Correct ?    414 Yes 59 No

how to find the second highest salary from emp table?..

Answer / gourvendra singh

Please put the below query, u will get the second highest
salary of the table :---

select sal from(select sal from
(select distinct sal from emp order by sal desc)
where rownum<=2 order by sal asc)
where rownum=1;

Is This Answer Correct ?    488 Yes 264 No

how to find the second highest salary from emp table?..

Answer / nalini

Follow the following Query, You get the second highest
salary.
SQL> Select level,Max(sal) from emp
Where level=&level connect by prior sal>sal
group by level;
SQL> Enter the level No=2 (Here enter 2 manually)

Then you will get the 2nd highest salary.
If you want 3rd Highest salary, then enter level no=3.

Is This Answer Correct ?    208 Yes 105 No

how to find the second highest salary from emp table?..

Answer / muhammed zaheer

select max(sal) from emp where sal < (select max(sal) from
emp)

Is This Answer Correct ?    85 Yes 16 No

how to find the second highest salary from emp table?..

Answer / anuj maheshwari

select sal from emp where sal=(select max(sal) from emp
where sal<(select max(sal) from emp));

Is This Answer Correct ?    34 Yes 5 No

how to find the second highest salary from emp table?..

Answer / erp_guns

SELECT MAX(sal) from emp a where &n=(select COUNT(DISTINCT
(SAL)) from emp b where a.sal<=b.sal)

Is This Answer Correct ?    39 Yes 22 No

how to find the second highest salary from emp table?..

Answer / shiva kumar

select max(salary) from table01
where salary <(select max salary from table01)

in mainframe env

Is This Answer Correct ?    27 Yes 13 No

how to find the second highest salary from emp table?..

Answer / radha sri seshu

second method is
select sal from emp e1 where 2=(select count(distinct(sal))
from emp e2 where e1.sal<=e2.sal);

Is This Answer Correct ?    35 Yes 22 No

Post New Answer



More SQL PLSQL Interview Questions

using comand prompt how can import table data and table space with example

2 Answers  


What is structural independence and why is it important?

0 Answers  


What is meaning of <> in sql?

0 Answers  


what is single byte over head in oracle..?

0 Answers  


What are Nested Tables? How will u delete 5 rows from Nested Tables

3 Answers   IBM,






How do sql triggers work?

0 Answers  


What is the most common sql injection tool?

0 Answers  


What is a design view?

0 Answers  


How can we store rows in PL/SQL using array?

0 Answers   MCN Solutions,


What is the purpose of cursors in pl/sql?

0 Answers  


what is the difference between sql and t-sql? : Transact sql

0 Answers  


Can we insert in view in sql?

0 Answers  






Categories