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

how to create a new table in mysql? : Sql dba

986


How many sectors are in a partition?

1076


What is memory optimized table?

1046


What are the benefits of pl/sql packages?

1107


What are different types of queries in sql?

1121


What is the difference between microsoft access and sql?

1024


How will you distinguish a global variable with a local variable in pl/sql?

1154


How are functions and procedures called in PL/SQL?

1230


Can we perform dml in function?

1067


What is the difference between a query and a report?

976


What is right join sql?

967


Is sql a scripting language?

1017


Why self join is used in sql?

977


What is the difference between joins?

1040


How do I run pl sql in sql developer?

1120