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 retrieve a second highest salary from a table?
Note:Suppose salaries are in duplicate values
eg:
Name Sal
Malli 60000
Pandi 60000
Rudra 45000
Ravi 45000

Answer Posted / praveenpinfo

Suppose table name is EMP.

SQL> Select distinct sal from emp e1 where 2=(select
count(distinct sal) from emp e2 where e1.sal<=e2.sal);

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what are set operators in sql? : Sql dba

1054


How can I see all tables in sql?

1077


what is online transaction processing (oltp)? : Sql dba

994


what are sequences

1748


How many parts of a pl sql block are optional?

1134


how to decrement dates by 1 in mysql? : Sql dba

1020


List the ways to get the count of records in a table?

900


What is difference between inner join and self join?

1084


What is the difference between union and union all command?

1090


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

1158


Can I call a procedure inside a function?

1011


what is a database transaction? : Sql dba

1184


What are local and global variables and their differences?

1092


What is full join in sql?

991


How do I edit a stored procedure?

992