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 is the difference between char and varchar data types? : Sql dba

1098


What is interval partition?

1051


What is a delimiter in sas?

1051


How does cross join work?

947


Why do we need unique key in a table?

955


What are different functions in sql?

940


What is the usage of sql functions?

1144


how many triggers are allowed in mysql table? : Sql dba

1061


what is rollback? : Sql dba

1103


What do you mean by query optimization?

998


Suppose a student column has two columns, name and marks. How to get name and marks of the top three students.

1003


What is the difference between count 1 and count (*) in a sql query?

987


What is clustered and nonclustered index in sql?

939


How do you determine the current isolation level? : Transact sql

1152


What is the use of %rowtype?

1035