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);
| Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
What function does a database engine serve in the sql server?
How to rename an existing column with the "sp_rename" stored procedure in ms sql server?
What types of Joins are possible with Sql Server?
State a few properties of relational databases?
Explain candidate key, alternate key, and composite key?
what is a schema in sql server 2005? : Sql server database administration
what are the steps you will take to improve performance of a poor performing query? : Sql server database administration
what are the different ways to return the rowcount of a table?
List the various tools available for performance tuning?
What is the difference between a unique key and primary key?
What part does database design plays a role in performance of an sql server-based application?
What is dml command?
Explain different backup plans?
Tell me about joins in database system and explain each in detail.
How to select some specific columns from a table in a query in ms sql server?