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

Can we use insert statement in function?

1005


What are variables in pl sql?

1172


Explain lock escalation? : Transact sql

1207


What is field delimiter?

1051


what are the nonstandard string types? : Sql dba

1145


What is database migration?

973


how can we destroy the cookie? : Sql dba

1016


Can dml statements be used in pl/sql?

1089


what is the stuff function and how does it differ from the replace function? : Sql dba

1062


Write an sql query to select all records from the table?

1037


Can I learn sql in a week?

1083


Does truncate free space?

1018


What is an exception in pl/sql?

1095


What is the need of a partition key?

989


Does truncate need commit?

951