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 / bharath reddy

These qeries give you second higest salary

select e.sal from emp e,emp d where d.sal>e.sal
group by e.sal
having count(e.sal)=2
;

SAL
-----
3000

(or)

select distinct e.sal from emp e where (select count(sal)
from emp d where d.sal>e.sal)=1;

SAL
-----
3000

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is the use of set statement in tsql? : Transact sql

1059


Does oracle use sql?

990


How to change a value of the field ‘salary’ as 7500 for an employee_name ‘john’ in a table employee_details?

1490


What is the difference between a procedure and a function?

1211


What is count * in sql?

1040


What is oracle sql called?

972


What is oracle pl sql developer?

1024


What does t sql mean?

1000


How to process query result in pl/sql?

1198


What is vector point function?

1094


What are local and global variables and their differences?

1137


Define commit?

1053


What is application trigger?

1054


what is the difference between union and union all? : Sql dba

1068


explain the difference between bool, tinyint and bit. : Sql dba

1063