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 scalar functions?
In one interview...interviewer ask me question pleas tell me sql server architecture.. can any body tell me the sql server architecture with digram
Explain the use of keyword with encryption. Create a store procedure with encryption?
How to update values in a table with update statements in ms sql server?
How you would rewrite the sql query to return the customerid sorted numerically?
How dts is used to extract, transform and consolidate data?
How to test odbc dsn connection settings?
What is side by side migration in sql server?
What is store procedure? When do you use?
What are tables in sql server?
What are the key configuration files for sql server reporting services ?
What is table constraint?
What are points to remember while using the fillfactor argument?
Tell me the difference between clustered and non-clustered index?
How to override dml statements with triggers?