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

What are the events on which a database trigger can be based?

1099


explain about mysql and its features. : Sql dba

967


What are all the ddl commands?

1112


How do I create an index in word?

965


What is PL/SQL Records?

1113


What are sql commands?

933


What is sql resultset?

929


What is sqlite format?

1106


Can you sum a count in sql?

952


Lookups are a key component in sql server integration services (ssis). Explain its purpose?

953


what is “go” in t-sql? : Transact sql

1038


Where do we use pl sql?

942


Can we use delete in merge statement?

999


What are the most important characteristics of pl/sql?

1076


what are the different tables present in mysql, which type of table is generated when we are creating a table in the following syntax: create table employee (eno int(2),ename varchar(10)) ? : Sql dba

987