Write a query to find second highest salary of an employee.




Answers were Sorted based on User's Feedback



Write a query to find second highest salary of an employee. ..

Answer / ravi

I write this query and it run !!

SELECT max(salary) FROM Employee WHERE Employee.salary <
(SELECT max(salary) FROM Employee)


Plz reply if anyone having generic answer. :-)

Thanks

Is This Answer Correct ?    308 Yes 56 No

Write a query to find second highest salary of an employee. ..

Answer / pradeep kumar

Select max(salary) from emp where salary NOT IN (Select max
(salary) from emp)

Is This Answer Correct ?    95 Yes 14 No

Write a query to find second highest salary of an employee. ..

Answer / dharmaraj

SELECT max(salary) as salary FROM Employee WHERE salary <
(SELECT max(salary) FROM Employee)

Is This Answer Correct ?    67 Yes 8 No




Write a query to find second highest salary of an employee. ..

Answer / vittal

select max(sal)from emp e1 where 2<=(select count(*) from
emp e2 where e1.sal <= e2.sal);

Is This Answer Correct ?    66 Yes 38 No

Write a query to find second highest salary of an employee. ..

Answer / upali tejale

Select max(salary) from employee where salary NOT IN
(Select max(salary) from employee)

Is This Answer Correct ?    13 Yes 1 No

Write a query to find second highest salary of an employee. ..

Answer / priyanshu

select First_Name,Salary from employees where salary in
( select max(salary) from employees
where salary < ( select max(salary) from employees) ),

Is This Answer Correct ?    11 Yes 0 No

Write a query to find second highest salary of an employee. ..

Answer / sweety spear

select *from emp e1 where &n =(select count(*) from emp
where sal >= e1.sal);

Is This Answer Correct ?    13 Yes 3 No

Write a query to find second highest salary of an employee. ..

Answer / murlidhar

select * from emp A where 2=(select count(*) from emp B
where A.sal < B.sal)

Is This Answer Correct ?    41 Yes 36 No

Write a query to find second highest salary of an employee. ..

Answer / lokesh kanithi

Select * from emp e where 2=(select count(Distinct(esal))
from emp where e.esal<=emp.esal)

Is This Answer Correct ?    27 Yes 22 No

Write a query to find second highest salary of an employee. ..

Answer / rajkumar mandala

select sal from
(select rank() OVER (order by sal desc) sno ,sal from emp)
y
where sno= n

here
y : is the alias name for (select rank() OVER (order by sal
desc) sno ,sal from emp)
n : is the number ie if u want second highest sal then 'n'
value will be 2. for third highest n= 3...

Is This Answer Correct ?    7 Yes 2 No

Post New Answer



More Automation Testing AllOther Interview Questions

Can anybody tell me the any open source automation testing tool for functional testing to test web based application.? pls suggest its urgent.

2 Answers  


Hi friends, can anybody tell me what all the testing tools that persistant uses and what is the selection process for an fellow having 2yrs workexp on testing. Can anybody also help me out what is the minimum package that persistant is providing for 2yr workexp guy.

1 Answers  


Plz suggest me a tool which supports ActiveX controls

3 Answers  


What are main benefits of test automation?

0 Answers  


Does automation replace manual testing?

1 Answers  






In Selenium how a test suit is run and report is generated.

0 Answers  


What are the disadvantages of Hybrid framework

0 Answers  


What are the main attributes of test automation?

0 Answers  


How will you choose a tool for test automation?

0 Answers  


If testing is done using white box testing,then what is the need of using Black box testing again? I mean when unit testing and Integration testing is done at Coding level, what is the need of testing again at testing level?

1 Answers  


What are the main attributes of test automation?

2 Answers  


Does Microsoft Corporation, Sun Microsystems possesing any maturity levels?if yes, what is that level?

1 Answers   CTS,






Categories