how to find the 2nd higgest salary in the column for example
take table name is employee?
And also find bottom 2nd lowest salary ?
Answer Posted / vishnu
Here we can find out 2nd highest salary in many ways,
according to the situation we can select anyone…
1st Type:
select min(esal) from emp where esal in (select top 2 esal
from emp order by esal desc)
2nd Type:
select max(esal) from emp where esal not in(select max(esal)
from emp)
3rd Type:
select max(esal) from emp where esal <(select max(esal) from
emp )
4th Type:
select Max(esal) from EMP a where 2=(select
COUNT(distinct(esal)) from EMP b where a.eSAL<=b.eSAL);
-----------------------------------------
For 2nd Lowest Salary:
-- 1st Type:
select min(esal) from emp where esal > (select min(esal)
from emp)
-- 2nd Type:
select * from emp where esal =
(
select max(esal) from emp where esal in (select top 2 esal
from emp order by esal)
)
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
Define a managed code? : Dot net architecture
Can I customise the trace output?
What is the mesi? : .NET Architecture
Define cache? : Dot net architecture
How do I prevent concurrent access to my data?
Can you explain update progress control?
What happens to the winfx technologies?
Explain about clr?
Explain is development of a mobile web application with asp.net is very easy? : Microsoft dot net mobile
how to set the startup position of the form?
Explain dotnet framework ?
What is the numeric attribute of the textbox control in .net mobile? : Microsoft dot net mobile
What is Com Callable wrapper?when it will created?
What are the different pipelining hazards and how are they eliminated? : Dot net architecture
Different types of authentication modes in .net framework ?