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 / shriram

You can also do it by the following query ..

select * from (select name,salary,rank() over(order by
salary desc as r) from employee) where r = 2;

The above query returns the 2nd highest salary from the table.

Is This Answer Correct ?    3 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is pl sql collection?

1017


Enlist the characteristics of pl/sql?

1844


What is partition in sql query?

1045


What is a primary key sql?

1093


Can we use two order by clause in query?

1015


What are pl sql data types?

1056


Can %notfound return null after a fetch?

1102


What is sqlerrm?

986


What is sql injection vulnerability?

1005


Explain the commit statement.

1215


what is a constraint? : Sql dba

1232


Can we use having without group by in sql?

1051


what is cross join? : Sql dba

1050


what is the difference between where clause and having clause? : Sql dba

1045


Is sql database free?

1024