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
How to run queries with sql server management studio express?
what are statistics, under what circumstances they go out of date, how do you update them? : Sql server database administration
What are the pre-defined functions in the sql server?
What is the architecture of ms sql reporting service?
What are commonly used odbc functions in php?
What is bit data type? What's the information that can be stored inside a bit column?
How optimize sql query with multiple joins in sql server?
Explain contrast amongst grouped and non-bunched records?
How to transfer an existing table from one schema to another schema in ms sql server?
What are the two authentication modes in sql server?
Can we use where clause in union?
what is a schema in sql server 2005? Explain how to create a new schema in a database? : Sql server database administration
What is the security principal at the server level that represents your session?
Do you know what is a trace frag? Where do we use it?
What are the types of ssrs?