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 is the New in SQL server 2008?
What do I need to start working with sql studio? : sql server management studio
What happens if an integer is too big for int date type?
What is store procedure? When do you use?
What is row_number()?
How to declare a cursor with "declare ... Cursor" in ms sql server?
Explain “not null constraint” in sql server?
Is it true that rules do not apply to data already existing in a database at the time the rule is created?
on line cluster can we make if yes tell me the procedure
How to convert character strings into numeric values?
Can a database be shrunk with users active?
Suppose you want to implement the one-to-one relationships while designing tables. How would you do it?
What is implicit mode in sql server?
How to use subqueries in the from clause in ms sql server?
Explain trigger classes i.e. Instead of and after trigger?