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

Does sql support programming?

1050


Explain the difference in execution of triggers and stored procedures?

1003


What is the usage of distinct keyword?

1051


What do you understand by pl/sql packages?

1051


How do you use join?

923


What jobs use sql?

971


What is null in pl/sql?

1048


how can you create an empty table from an existing table? : Sql dba

1138


What is primary key and foreign key with example?

918


What will you get by the cursor attribute sql%notfound?

1042


Why truncate is used in sql?

985


How do I find sql profiler?

926


write an sql query to get third maximum salary of an employee from a table named employee_table. : Sql dba

958


What is difference between sql function and stored procedure?

991


How many row comparison operators are used while working with a subquery?

1020