Find out the 3rd highest salary?
Answers were Sorted based on User's Feedback
Answer / shruti
select empno,sal from
(select empno,sal from emp order by sal desc)
where rownum<4
Is This Answer Correct ? | 2 Yes | 0 No |
Answer / tathagoto
select min(sal) from (select sal from (select sal from
salary order by sal desc) where rownum <
4);
Is This Answer Correct ? | 4 Yes | 3 No |
Answer / sathiskumar
select min(sal) from (select top 3 salary from employee);
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / av.anil
SELECT * FROM
(SELECT Ename,Sal,
DENSE_RANK()
OVER(ORDER BY Sal DESC) "D_RK"
FROM Emp)
WHERE D_RK = 3;
This query gives exact highest salary.
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / jagdish
select max(sal) from emp where sal!=(select max(sal) from
emp where sal!=(select max(sal) from emp))
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / vivek
SELECT v.Emp_Sal
FROM Employee_Test v
WHERE 3=
(
SELECT COUNT(DISTINCT z.Emp_Sal)
FROM Employee_Test z
WHERE v.Emp_Sal<=z.Emp_Sal
)
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / shibin k abraham
select * from emp where sal=(select a.sal from emp awhere 3=(select distinct(count(b.sal)) from emp b where a.sal<=b.sal))
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / priyanga.g
1) Select MAX(salary) from Programmer where salary not
in(select top 2 salary from Programmer order by salary desc)
2) Select max(salary) from programmer where salary<
(select MAX(salary) from Programmer where salary<(select
MAX(salary) from Programmer))
3) Select MAX(salary) from Programmer e where 2=(select
COUNT(*) from programmer b where b.salary>e.salary )
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / ratnakar
select max(sal) from emp a where 3=(select count(sal) from
emp b where b.sal >=a.sal;
Is This Answer Correct ? | 10 Yes | 10 No |
Answer / sheik
select top 1 * from(select top 3 *from emp order by salary
desc)d order by salary asc
Is This Answer Correct ? | 0 Yes | 0 No |
wirte a query to filter improper date format follwing table? date 20-apr 22-may-2010 26-jun-2010 feb-2009 i want the output date 22-may-2010 26-jun-2010
Types of joins ?
3 Answers Digital GlobalSoft, HeadStrong,
function can return value ,procedure also return value through out parameter then what is the difference?
How subquery works in sql?
Can we use pl sql in sql server?
What is character functions?
suppose we have a table in which 200 rows. i want to find 101 row ? what the query.... and how we find 4th and 5th highest salary and 1 to 10 highest salary
Which command is used to delete a trigger?
What is a sql profiler?
Difference between truncate, delete and drop commands?
how to create user in sql and how to set password for that?
Can we use delete in merge statement?