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
what is the difference between char and varchar data types? : Sql dba
What is interval partition?
What is a delimiter in sas?
How does cross join work?
Why do we need unique key in a table?
What are different functions in sql?
What is the usage of sql functions?
how many triggers are allowed in mysql table? : Sql dba
what is rollback? : Sql dba
What do you mean by query optimization?
Suppose a student column has two columns, name and marks. How to get name and marks of the top three students.
What is the difference between count 1 and count (*) in a sql query?
What is clustered and nonclustered index in sql?
How do you determine the current isolation level? : Transact sql
What is the use of %rowtype?