Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

explain primary keys and auto increment fields in mysql : sql dba

1017


What is clustered and nonclustered index in sql?

987


What is Collation Sensitivity ? What are the various type ?

1002


Explain two easy sql optimizations.

1075


what are ddl statements in mysql? : Sql dba

1269


Why do we need unique key in a table?

1008


What is the difference between delete and truncate statement in sql?

1131


Does postgresql run on the cloud?

1222


How to fetch alternate records from a table?

1306


Can we use insert statement in function?

1048


what are rollup and cube in t-sql? : Transact sql

1151


What is primary key secondary key alternate key candidate key?

1088


What does the hierarchical profiler does?

1128


Can we debug stored procedure?

1069


Write a sql query to convert all character to uppercase after hypen.

1486