How to find the second largest salary in the emp database and
also How to find 3rd,4th and so on ........ in the emp database
plz mail the answer @ mak2786@gmail.com
Answer Posted / vishakha shrivastava
for second largest salary
Select * from emp a where 2=(select count(*) from emp b
where a.sal<=b.sal)
Above mentioned query can also be used for 3 ,4 ..n
Select * from emp a where 3=(select count(*) from emp b
where a.sal<=b.sal)
| Is This Answer Correct ? | 2 Yes | 5 No |
Post New Answer View All Answers
What are the disadvantages of indexes?
What is after dml trigger?
Explain what are the events recorded in a transaction log?
Tell me what is the order in which the sql query is executed?
Explain transaction server distributed transaction?
Can sql server 2016 run on windows 7?
How many types of triggers are there?
Difference between Sql server reporting services and Crystal reports?
How you can add messages to the nt event log from within a stored procedure?
What is the difference between varchar and nvarchar?
Why do we use stored procedures in sql server?
How much memory that we are using in Logshipping Concept?
Why do we use sql limitations? Which constraints can we use while making a database in sql?
how you can list all the tables in a database?
What are the purposes of floor and sign functions?