To find second largest salary in Employee table
Answer Posted / ram
select *from emp e where &n in(select count(distinct sal)
from emp m where e.sal<=m.sal);
which will ask's u like :
enter the value for n : 2 (enter 2)
gives u second highest.
| Is This Answer Correct ? | 4 Yes | 0 No |
Post New Answer View All Answers
What is a constant or literal in ms sql server?
What is a trigger what are the advantages of trigger?
Does sql server 2000 clustering support load balancing?
What is nonclustered index on computed columns?
What are the dmvs? : sql server database administration
How to get the query of a table in sql server?
How do I find the query plan in sql server?
How to concatenate two character strings together?
How to create nested stored procedure?
Explain the difference between functions and stored procedures in sql server?
What is sql server agent and what are the two modes of authentication in sql server?
What is the purpose of grouping data in a report?
When would you use it?
Does any body please help me what question's have asked for SSRS in the interview?
Is truncate a dml command?