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
A trigger can reference objects outside the current database? State true or false.
Tell me what is the difference between locking and multi-versioning?
What is difference in performance between insert top (n) into table and using top with insert?
What are the different types of stored procedures?
Can I use sql azure as a backup with log shipping or database mirroring?
What is the difference between sql server 2000 object owner and sql server 2005 schema? : sql server database administration
Can you explain how long are locks retained within the repeatable_read and serializable isolation levels, during a read operation with row-level locking?
What happens when transaction log is full?
How do I edit a procedure in sql server?
What is mean by candidate key?
where can you add custom error messages to sql server? : Sql server administration
How display code or Text of Stored Procedure using Sql query in Sql Server ?
What is isnull() operator?
Do you know what is xpath?
How to create user messages with print statements in ms sql server?