Find 2nd Highest salery in emp table
Select* from emp where &n=
select * count from emp where (salery >=emp.salery)
Enter n value 2
These query is correct or not. Tell me any other methods.
Answer Posted / lince
select top 1 * from (select distinct top 2 * from emp order by sal desc)t order by sal asc
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What are binary string data types in ms sql server?
What is the sql server agent?
How many databases Microsoft SQL server provides?
What is schemabinding a view?
What is dbcc? Give few examples.
How to delete an existing row with delete statements in ms sql server?
What is the maximum row of a size?
What is your recommendation for a query running very slow? : sql server database administration
what is the primary use of the model database? : Sql server administration
How to execute a sql statement using mssql_query()?
What is change data capture (cdc) in sql server 2008?
What is difference between inner join and join?
Are there any preferred steps that need to be taken care of before starting the installation of sql server 2000?
What are indexes in sql?
If a stored procedure is taking a table data type, how it looks?