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 / kb

select top 1 * from emp
where sal < (select max(sal)from emp)
order by sal desc

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what stored procedure can you use to display the current processes? : Sql server administration

528


What is the command to change the recovery model?

565


What is equi join with example?

551


What is updatable resultset?

514


What are the types of database schema? : sql server analysis services, ssas

598






How to skip remaining statements in a loop block using continue statements?

539


Explain user defined views?

573


What is the difference between rank and dense_rank?

502


How to list all field names in the result set using mssql_field_name()?

522


Explain transaction isolation levels in sql server?

545


How do I view views in sql server?

516


How to query multiple tables jointly?

554


What are the differences in Clustering in SQL Server 2005 and 2008 or 2008 R2?

593


A trigger can reference objects outside the current database? State true or false.

550


How to use column default values in insert statements in ms sql server?

521