find out the third highest salary?
Answers were Sorted based on User's Feedback
Answer / shivaprasad
Hi Every one,this query will helps you to find 1st or 2nd or
3rd or and so on salary from the employee table.
change inside distinct top (3) for respective results
select distinct top 1 Salary from(select distinct top 3
Salary from Employee order by Salary DESC)temp order by
Salary;
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / narendra
select max(company_id) from company where company_id <
(select max(company_id) from company where company_id <
(select max(company_id) from company))
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / sabapathi
select sal from employee
where sal=(select min(sal) from employee
where sal>(select min(sal) from employee
where sal>(select min(sal) from employee)))
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / mohd. rashid
SELECT TOP 1 salary
FROM(
SELECT DISTINCT TOP 3 salary
FROM employee
ORDER BY salary DESC)
ORDER BY salary
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / ravindra
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 / santhoshkumar
select name,salary from emp where salary=(select min(sal)
from (select distinct TOP 3(salary) from emp order by
salary desc;
Is This Answer Correct ? | 5 Yes | 5 No |
Answer / ram pravesh
select max(sal) from emp where sal<(select max(sal)from emp
where sal<(select max(sal) from emp))
Is This Answer Correct ? | 2 Yes | 2 No |
Answer / pardeep kumar
This is the Simplest One
Let i have a Column named EmpSal in Tbale Named tbEmp
Select Min(EmpSal) from tbEmp where EmpSal IN(Select
Distinct Top 3 EmpSal from tbEmp ORDER BY EmpSal DESC)
Is This Answer Correct ? | 1 Yes | 1 No |
Answer / ashok naik
In Sql server:
Select top 1 ThirdHighest.salary from(
Select distinct top 3 salary from employee order by salary
desc) as ThirdHighest
--example for 4th highest salary in above query put 4
inplace of 3
--example for 5th highest salary in above query put 5
inplace of 3
--and so on for nth highest
Is This Answer Correct ? | 1 Yes | 1 No |
Answer / harikrishna ravipati
select max(sal) from emp where sal <
(select max(sal) from emp where sal <
(select max(sal) from emp))
Is This Answer Correct ? | 0 Yes | 0 No |
how to find out largest value in a table
What do you mean by group by clause?
What is a view and how is it different from a table?
how to find out second largest value in the table
cursor attributes are %isopen ,%notfound,%found,%rowcount but is any attributes there other than these? please tell me asap ..
how to store only time in a data base table
can anyody please send me the dump for Oracle 10g certifications for DBA path?
How to compare dates in oracle sql?
What is autonomous transaction?
How to use attributes of the implicit cursor in oracle?
Explain the use of parfile option in exp command.
1) What is dense ranking? 2) Difference between Substring and Instring? 3) Case and Decode? 4) Pseudo column? 5) View vs Materialized views? 6) SQl performance tuning?