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 / radha sri seshu.kolla

select max(sal) from emp where level=2 connect by prior
sal>sal group by level;

Is This Answer Correct ?    17 Yes 22 No

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

Answer / shalina bajaj

select sal from emp a
where $number = (select count(distinct(sal))
from emp b
where a.sal <= b.sal);

Is This Answer Correct ?    11 Yes 17 No

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

Answer / prasanthi

select * from (select rownum r,a.* from (select distinct
sal from emp order by sal desc)a)where r=&i

sql>enter i value(enter manually) 2

Is This Answer Correct ?    54 Yes 62 No

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

Answer / prasanna

select A.* from employee A where 1=(select count(distinct
B.sal) from employee B where B.sal>A.sal)

Is This Answer Correct ?    63 Yes 71 No

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

Answer / ved

select sal from emp
where limit,1
order by sal desc

Is This Answer Correct ?    12 Yes 20 No

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

Answer / raghavendraprasad

select salary from emp e where &n-1=(select count(*) from
emp where salary>e.salary);

Is This Answer Correct ?    7 Yes 15 No

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

Answer / ramesh lavanuru

SELECT sal1 "salary"
FROM (SELECT ROWNUM rownum1 ,sal1
FROM (SELECT sal sal1
FROM emp
ORDER BY sal DESC
)
)
WHERE rownum1=:p_highest;

Note:- 'p_highest' here we can give the number as we want
to display the highest salary.

Is This Answer Correct ?    52 Yes 63 No

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

Answer / avinav

By using the rank function we can get the 2nd highest
salary from the emp table

Is This Answer Correct ?    10 Yes 25 No

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

Answer / pradeep

select sal from emp
where rownum=2
order by sal desc

Is This Answer Correct ?    10 Yes 50 No

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

Answer / rameshwari

select ename,esal from
(select ename,esal from hsal
order by esal desc)
where rownum <=2;

Is This Answer Correct ?    123 Yes 242 No

Post New Answer

More SQL PLSQL Interview Questions

What does the acronym acid stand for in database management?

0 Answers  


What are inner and outer joins examples of both?

0 Answers  


How can I tell if sql is running?

0 Answers  


how do you know if your mysql server is alive? : Sql dba

0 Answers  


Is it mandatory for the primary key to be given a value when a new record is inserted?

0 Answers  


have table with two columns with datatypes as number and varchar and the values in A column like 1,2,3 AND B column values like a,b,c. now need to display data in a single column as 1,a,2,b,3,c.

8 Answers   IBM, Zensar,


Why use subqueries instead of joins?

0 Answers  


what is SCALAR Queries?

2 Answers   ITC Infotech,


Can a view be updated/inserted/deleted?If Yes under what conditions?

3 Answers  


what is the difference between cluster and non cluster index? : Sql dba

0 Answers  


What is a procedure in pl sql?

0 Answers  


what is a unique key ? : Sql dba

0 Answers  


Categories