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

Is natural join same as inner join?

911


What is consistency?

1108


List the various privileges that a user can grant to another user?

1034


What type of database is sql?

1017


Can 2 queries be executed simultaneously in a distributed database system?

1132


Is sql a backend?

1005


how can we repair a mysql table? : Sql dba

961


What does bitemporal mean?

1051


how to shut down the server with 'mysqladmin'? : Sql dba

993


How are functions and procedures called in PL/SQL?

1197


Explian rowid, rownum?

998


difference between anonymous blocks and sub-programs.

1123


What is difference between db2 and sql?

985


Is sql better than access?

997


Enlist the advantages of sql.

989