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?

Answers were Sorted based on User's Feedback



how to find the second highest salary from emp table?..

Answer / shrikant

You can find nth max salary

change "limit 0,n" where n = 1,2,3...

select b.sal from (select a.sal from (select distinct sal
from emp order by sal desc) a limit 0,n) b order by sal asc
limit 0,1;

Is This Answer Correct ?    0 Yes 1 No

how to find the second highest salary from emp table?..

Answer / shivdas suryawanshi

select salary from emp where salary=(select max(salary)
from emp where salary < (selct max(salary) from emp));

Is This Answer Correct ?    0 Yes 1 No

how to find the second highest salary from emp table?..

Answer / nirjesh pandey

select salary from employee order by salary DESC LIMIT(1,1)

Is This Answer Correct ?    0 Yes 1 No

how to find the second highest salary from emp table?..

Answer / nirjesh pandey

select salary from employee order by salary DESC LIMIT(1,1);

Is This Answer Correct ?    0 Yes 1 No

how to find the second highest salary from emp table?..

Answer / masthan

select *from emp where sal<selct *from emp where<select *from emp

Is This Answer Correct ?    0 Yes 1 No

how to find the second highest salary from emp table?..

Answer / hridayeshwar rao

select max(age) from yd where age<(select max(age) from HK) ; /// True two table Highest

SELECT * FROM HK E1 WHERE 1 =(SELECT COUNT(DISTINCT age) FROM HK E2 WHERE E1.age < E2.age); ///Second Hightest age RT single table

select age from hk e1 where (3-1) = (select count(distinct (e2.age)) from yd e2 where e2.age>e1.age);//// same True Second Hight age RT two table

select max(age) from YD where age not in (select max(age) from YD); //second hight age in single table

Suppose that salery=age

Thanks !!!

Is This Answer Correct ?    0 Yes 1 No

how to find the second highest salary from emp table?..

Answer / abhijeet banarse

Select level,Max(sal) from emp1
Where level=&level connect by prior sal>sal
group by level;
Enter the level No=2 (Here enter 2 manually)

Is This Answer Correct ?    0 Yes 1 No

how to find the second highest salary from emp table?..

Answer / moharaj m

select max(salary) from emp where salary < (select max
(salary) from emp)

Is This Answer Correct ?    0 Yes 1 No

how to find the second highest salary from emp table?..

Answer / rajesh chauhan

sql>select max(salary)from(select salary from employee where
salary not in(select max(salary)from employee))

Is This Answer Correct ?    0 Yes 1 No

how to find the second highest salary from emp table?..

Answer / waqas

Hi for second highest record follow this link
http://www.codingresolved.com/discussion/50/how-to-get-second-highest-record-in-sql#Item_2

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More SQL PLSQL Interview Questions

In table a 1lakh data is present,in table b 20 thousand data is present, to get unique data from table a and b which join to be considered. whether right outer join or left inner join. 

2 Answers   GE,


I am creating an index on Emp table Empno column,if u using this indexed column in ur SELECT stmt. where clause,then how do u know that yr index will be working or nor? Thanks Advance...

3 Answers  


Does sql support programming?

0 Answers  


Can you call pl/sql package functions from within a fast formula?

0 Answers  


How to select all records from the table?

0 Answers  


What is the difference between joins?

0 Answers  


hi sql gurus, here is my question 4 u. i wanna use triggers for sending reminder mail to all users who are registered to the site. if any one knws the code plz send me ans here : chayabs3@gmail.com thnx advance

1 Answers  


How does postgresql compare to mysql?

0 Answers  


How many types of database triggers can be specified on a table ? What are they ?

2 Answers  


Which command is used to delete a package?

0 Answers  


How many types of triggers are there in pl sql?

0 Answers  


Which are the different types of indexes in sql?

0 Answers  


Categories