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

SELECT MAX(SAL) FROM EMP WHERE SAL < ( SELECT MAX(SAL) FROM
EMP )

Is This Answer Correct ?    7 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain important index characteristics?

553


What are the kinds of subquery?

525


What are the different types of collation sensitivity in sql server?

580


What structure can you implement for the database to speed up table reads?

706


Is it important for a database administrator to understand the operating system and file access?

506






What is the command used to recompile the stored procedure at run time?

614


What is mssql?

564


How does recursive cte works in sql server?

523


How to locate and take substrings with charindex() and substring() functions?

507


What do you think of this implementation? Can this be implemented better?

531


What are the basic functions for master, msdb, model, tempdb and resource databases?

548


Can we join two tables without primary key?

608


Explain atomicity?

569


Is sql server 2016 free?

527


Explain the use of containers in ssis and also their types?

522