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


Write a query to find second highest salary of an employee.

Answers were Sorted based on User's Feedback



Write a query to find second highest salary of an employee. ..

Answer / rajasekhar.v

For selecting Nth highest salary...

SQL> select rownum rank,ename,sal from
(select ename,sal from emp order by sal desc)
group by rownum,ename,sal
having rownum = &n;
'n' may be any valid number required..

Is This Answer Correct ?    1 Yes 0 No

Write a query to find second highest salary of an employee. ..

Answer / murali

SELECT
MAX(Sal)
FROM
Emp
WHERE
Level=&Levelno
ORDER BY PRIOR Sal>Sal
GROUP BY Level

--Here we have to give &Levelno = 2

Is This Answer Correct ?    1 Yes 0 No

Write a query to find second highest salary of an employee. ..

Answer / dilip

select rank,sal from(select rownum rank,distinct(sal) from
emp order by sal desc)
where rank=2;

Is This Answer Correct ?    1 Yes 0 No

Write a query to find second highest salary of an employee. ..

Answer / shahid parvez

select max(sal) from Emp where sal < (select max(sal) from
Emp)

Is This Answer Correct ?    1 Yes 1 No

Write a query to find second highest salary of an employee. ..

Answer / gyana ranjan behera

select ename,sal.rn from(select ename,sal,rownum rn from(select ename,sal from emp order by sal desc))where rn=2;

Is This Answer Correct ?    0 Yes 0 No

Write a query to find second highest salary of an employee. ..

Answer / satheesh

SELECT MAX(SAL) FROM EMP A
WHERE SAL NOT IN(SELECT MAX(SAL) FROM EMP B);

Is This Answer Correct ?    0 Yes 0 No

Write a query to find second highest salary of an employee. ..

Answer / manikumar

Select Sal from Emp where Sal in (Select Max(Sal) from Emp)

Is This Answer Correct ?    0 Yes 1 No

Write a query to find second highest salary of an employee. ..

Answer / oboyah

SELECT e1.* from ( SELECT last_name, salary,
DENSE_RANK() OVER ( ORDER BY salary DESC) rank
FROM employees) e1 where e1.Rank = 2;

Is This Answer Correct ?    0 Yes 1 No

Write a query to find second highest salary of an employee. ..

Answer / om patel

select (distinct(a.sal) from emp e where rownum=&N(select
count(distinct(b.sal)) from emp b where a.sal<=b.sal)

Is This Answer Correct ?    0 Yes 1 No

Write a query to find second highest salary of an employee. ..

Answer / akilis.org@hotmail.com

Let us assume that
Table Name:salary
Coloumn Name:maxsal(int)
select * from salary order by maxsal desc limit 1,1;

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More SQL PLSQL Interview Questions

What are literals in sql server?

0 Answers  


Can unique keys be null?

0 Answers  


how can i create a user defined datatype

3 Answers  


difference between pl/sql table and normal pl/sql table

2 Answers  


What is scope of pl sql developer in future?

0 Answers  


Which is faster count (*) or count 1?

0 Answers  


I have a small PL/SQL Block assume in this way begin select * from emp where empno=100; exception when others then <Some Messages> when no_data_found then <Some Messages> when too_many_rows then <Some Messages> end; The question which he asked was whether this block will get executed normally or it will throw error ? If errored out then what is the reason for the error ? Could anybody please help me ? Regards Nakul Venkataraman

3 Answers   Satyam,


What is identity column in sql server?

0 Answers  


What is the need of a partition key?

0 Answers  


What is a procedure in pl sql?

0 Answers  


What is difference between pl and sql?

0 Answers  


What is the purpose of normalization?

0 Answers  


Categories