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

With cte as (
Select *, Dense_rank() over (order by salary desc) as s from emp)
Select EmpName, Salary from cte where s =2
It has work. But duplicate value is not removed if name is different

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How does join work in sql?

998


Mention what does plvtab enables you to do when you showthe contents of pl/sql tables?

1147


What are different categories of sql commands?

1118


Is left join and outer join same?

1045


how to get a list of indexes of an existing table? : Sql dba

949


How do I partition in sql?

948


How do you delete duplicates in sql query using rowid?

930


What is the difference between sql and isql*plus?

1075


Is keyword pl sql?

967


Why we use join in sql?

946


Who is the owner of mysql database?

1039


What is the largest value that can be stored in a byte data field?

1002


What is sql and explain its components?

1045


How many sql are there?

977


How can you fetch common records from two tables?

1051