how to get second highest salary in SQL(as/4000

Answers were Sorted based on User's Feedback



how to get second highest salary in SQL(as/4000..

Answer / siva kumar yachamaneni

select max(salary) from Employee where salary<(SELECT
max(salary) from Employee)

Is This Answer Correct ?    0 Yes 1 No

how to get second highest salary in SQL(as/4000..

Answer / prabir

Select * From employee emp1 Where 2 = (Select
Count(Distinct(emp1.salary)) From employee emp2 Where
emp2.salary > emp1.salary)

Is This Answer Correct ?    3 Yes 5 No

how to get second highest salary in SQL(as/4000..

Answer / shasi

select sal from emp a where &n=(select count(sal) from emp
b where a.sal>=b.sal)
First u enter 1 means 1st highest sal.then enter2 2nd
highest sal

Is This Answer Correct ?    1 Yes 3 No

how to get second highest salary in SQL(as/4000..

Answer / ashish raut

for 2nd highest price..............

SELECT max(Price) as [MaxPrice] from OrderDetails
where Price<(SELECT max(Price)as MaxPrice from OrderDetails)

for 3rd highest Price........

SELECT max(Price) as [MaxPrice] from OrderDetails
where Price<(SELECT max(Price)as MaxPrice from OrderDetails
where price<(SELECT max(Price)as MaxPrice from OrderDetails))

Is This Answer Correct ?    0 Yes 2 No

how to get second highest salary in SQL(as/4000..

Answer / praveen

select * from emp where max(sal)
where rownow=2

Is This Answer Correct ?    0 Yes 2 No

how to get second highest salary in SQL(as/4000..

Answer / apurva

Select *
From (
Select *
From (select * from emp order by sal desc)
Where rownum < 3 order by sal) ---> n+1 for example for
secound you should use 3
Where rownum < 2

Is This Answer Correct ?    4 Yes 7 No

how to get second highest salary in SQL(as/4000..

Answer / sachin bhalsinge

select * from (select salary from employees order by salary
desc)where rownum=2;

Is This Answer Correct ?    5 Yes 11 No

how to get second highest salary in SQL(as/4000..

Answer / ramesh.p

Select salary
From ( Select salary from emp order by salary desc)
Where rownum =2;

Is This Answer Correct ?    10 Yes 19 No

how to get second highest salary in SQL(as/4000..

Answer / siddhartha

select sal, ename from employee where ROWNUM = 2 order by
sal;

Is This Answer Correct ?    12 Yes 36 No

Post New Answer

More SQL PLSQL Interview Questions

Is left join same as join?

0 Answers  


what is the difference between the query and corelated query

8 Answers   HSBC, IBM, TCS, Xenosoft,


what is online transaction processing (oltp)? : Sql dba

0 Answers  


difference between oracle 8i and oracle 9i

8 Answers  


How you can copy a file to file content and file to pl/sql table in advance pl/sql?

0 Answers  






Can we declare a column having number data type and its scale is larger than pricesionex: column_name number(10,100),column_name numbaer(10,-84)

0 Answers  


Does it possible to pass object (or) table as an argument to a remote procedure?

1 Answers   TCS,


can a stored procedure call itself or recursive stored procedure? How much level sp nesting is possible? : Sql dba

0 Answers  


what is column? : Sql dba

0 Answers  


What are different clauses used in sql?

0 Answers  


write a query filter the null value data following source? name age john 30 smith null null 24 sharp 35 i want output name age john 30 sharp 35

1 Answers   TCS,


how many columns can be used for creating index? : Sql dba

0 Answers  


Categories