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 find the second highest salary from emp table?

Answer Posted / ashish damohiya

Answer :
Select max(salary) from Emp_Table where max(salary) not in
(Select max(Salary) from Emp_Table)
this sufficient answer.

but there change the format of question that
How to find the second highest salary of each employee form
emp table ?

Answer :

with cte as (
select rank() over(order by emp_name) rank1 , ROW_NUMBER()
OVER(partition by emp_name ORDER BY basic desc) row,
emp_name, basic from emp_master)
select * from cte where row =2 or rank1 in ( select rank1
from cte group by rank1 having count(rank1)=1)

there i am used the MS SQL Server 2005.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why is sql important?

1109


Why is sharding used?

998


Can dml statements be used in pl/sql?

1081


What is pl sql architecture?

962


Why do we use joins?

1040


How to change a value of the field ‘salary’ as 7500 for an employee_name ‘john’ in a table employee_details?

1438


Explain what is rdbms?

1037


What is mutating trigger?

1024


What does stand for in sql?

973


Explain some predefined exceptions.

1040


What are all the different normalization?

1038


How many joins can you have in sql?

938


Is sql dba a good career? : SQL DBA

992


What is a primary key example?

959


Is sql pronounced sequel or sql?

1269