how to find the second highest salary from emp table?
Answer Posted / pranav damele
All the above one works with Oracle; this one is for MYSQL
second highest :
mysql> select * from employee group by salary desc limit 1,1;
limit 1,1; first '1' means that bring cursor to the end of record and the next '1' means number of records to be printed after the cursor position.
third highest:
mysql> select * from employee group by salary desc limit 2,1;
limit 2,1; '2' means that bring cursor to the end of 2nd record and the next '1' means number of records to be printed after the cursor position.
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
explain primary keys and auto increment fields in mysql : sql dba
What is clustered and nonclustered index in sql?
What is Collation Sensitivity ? What are the various type ?
Explain two easy sql optimizations.
what are ddl statements in mysql? : Sql dba
Why do we need unique key in a table?
What is the difference between delete and truncate statement in sql?
Does postgresql run on the cloud?
How to fetch alternate records from a table?
Can we use insert statement in function?
what are rollup and cube in t-sql? : Transact sql
What is primary key secondary key alternate key candidate key?
What does the hierarchical profiler does?
Can we debug stored procedure?
Write a sql query to convert all character to uppercase after hypen.