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
How can we rewrite sub-queries into simple select statements or with joins?
What are blobs, tables, and Queues? Is SQL is the standard way to query blobs, tables, and queues?
What is an expression in ms sql server?
how to control the amount of free space in your index pages? : Sql server database administration
What is self join in sql server joins?
What is the use of stored procedure?
What is resource governor in sql server?
Why variables called the most powerful component of ssis?
What type of locking occurs during the snapshot generation? : sql server replication
What do you understand by check constraint in sql server?
Explain the difference between HTTP and HTTPS in database?
Write a Select Query to display title for each group of records, which are collected with Compute Clause? Like titlefield column-A column-B ..... ..... ..... Sum ... titlefield column-A column-B ..... ..... ..... Sum ...
How to get the definition of a trigger back?
What is a cube? : sql server analysis services, ssas
What are different types of database indexes?