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


Please Help Members By Posting Answers For Below Questions

You are designing a strategy for synchronizing an SQL Azure database and multiple remote Microsoft SQL Server 2008 databases. The SQL Azure database contains many tables that have circular foreign key relationships?

99


What is compound operators?

544


What does it mean if @@cursor_row returns a negative number?

569


What authentication modes does sql server support?

594


What are the advantages of using cte?

548






What is triggers in ms sql server?

638


What is a view and what are its advantages?

686


Does full backup break log chain?

543


What is a partition function in sql server?

535


What is merge replication?

710


1.what is the diff between nolock optimizer and read uncommitted isolation? 2.what is the diff between revoke and deny? 3.what is percieved down time? 4.whether password protection are required for backups?if yes why?if no why? 5.what is fill factor? 6.what is cost analysis? 7.what is mean by piece meal restore? 8.what is 'rowguidcol'? 9.impersonate permission? 10.what is selectivity?

1626


What is open database communication (odbc)?

567


What is master database? : SQL Server Architecture

525


explain different types of constraints? : Sql server database administration

513


Explain acid?

604