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 ?    313 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 16 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 9 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

In general, how do you see automation fitting into the overall process of testing?

0 Answers  


what is the difference or comparison between QTP and rational? and which tool is better to use?

1 Answers  


Can test automation improve test effectiveness?

2 Answers  


hi Friends this is Srinivas. Can u discribe about bug lifecycle.how to say in interview.send me my mail :dsrao106@gmail.com

5 Answers   Wipro,


Why do you prefer selenium automation tool?

0 Answers  


Who is the best faculty for Automation testing in hyderabad

0 Answers  


Hi every body.. Whn i install QC 9.2 in window xp sp2 it ll show the error msg as it will nt support. How can i install in this OS.. Plz plz help me and i installed IIS and oracle 8i.. Plz Plz help me for this one

1 Answers  


We have a testing assignment that is time-driven. Do you think automated tests are the best solution?

0 Answers  


Hi, Can anyone please tell me which Test Automation tool can be used for : 1. Web based testing 2. .Net (C#) applications 3. Mobile applications (PDA)

1 Answers  


what is 2 tier and 3 tier application.

0 Answers  


Does automation replace manual testing?

2 Answers  


I am using the selenium tool for my web application testing I recorded some script and agian i played same but while playing: Alert msg is not getting closed It needs the manual interaction [Note:Here alert is generated not at the time of onload event] Please provide some solution for this

2 Answers  


Categories