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...

You have one employee table having 3 entries emp_id, Mgr_id
and salary. Mgr_id is also referencing emp_id. so now find
out the emp_id which are having the second highest salary,
under a particular manager.

Answer Posted / rajesh

select * from (select
emp_id,mgr_id,salary,dense_rank()over(partition by mgr_id order by salary desc nulls last) rn from emp) where rn=2;

Is This Answer Correct ?    5 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to recover a dropped table in oracle?

1051


Is there a combination of "like" and "in" in sql?

1072


Hi Can any one tell me what are the API's used in requisition import.

1927


What the is the diff between local index and global index. give some example.

1645


What are transaction isolation levels supported by oracle?

1081


I just want to maintain data like an employee can belongs to 3 or more departments . We can resolve this by using composite key but it avoids normalization rules. So Can anyone tell me how can I maintain data.

2187


What is difference between sid and service name in oracle?

966


How to view the tablespaces in the current database?

986


What is a data lock in oracle?

1137


Is it possible to center an object horizontally in a repeating frame that has a variable horizontal size ?

2363


What is logical backup in oracle?

1025


What do you know about normalization? Explain in detail?

956


What privilege is needed for a user to query tables in another schema?

979


Tab A A B ------ 1 A 2 B 3 C Tab B A B ----- 4 D 5 E 6 F Generate the value into B table from A table. Only table A has the value. Write the SQL query to get B table value.

1791


Explain the truncate in oracle?

973