how to find the second highest salary from emp table?
Answer Posted / shrikant
You can find nth max salary
change "limit 0,n" where n = 1,2,3...
select b.sal from (select a.sal from (select distinct sal
from emp order by sal desc) a limit 0,n) b order by sal asc
limit 0,1;
| Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
How do I add a database to sql?
What is compiled query?
what is the difference between primary key and unique key? : Sql dba
What is cross join sql?
What are reports usually used for?
How do you break a loop in pl sql?
What is rowtype?
Which operator is used in query for pattern matching?
what are the non-standard sql commands supported by 'mysql'? : Sql dba
How to avoid using cursors? What to use instead of cursor and in what cases to do so?
Is the primary key an index?
Difference between table function and pipelined function?
how are mysql timestamps seen to a user? : Sql dba
What is the difference between joins?
how can we take a backup of a mysql table and how can we restore it. ? : Sql dba