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 retrieve 5th highest sal from emp table?

Answers were Sorted based on User's Feedback



How to retrieve 5th highest sal from emp table?..

Answer / amit bhagat

select min(a.sal) from (select distinct(d.sal) from emp
order by d.sal desc) a where rownum<=5

Is This Answer Correct ?    5 Yes 0 No

How to retrieve 5th highest sal from emp table?..

Answer / venkata

hi, earlier query return sal in asending order and when
duplicate salries are there the earlier highest salary
position returns no rows. I hope this is better query.


select * from (select * from emp order by sal desc)
group by
rownum,empno,ename,job,mgr,hiredate,sal,comm,deptno having
rownum=&n

Is This Answer Correct ?    3 Yes 0 No

How to retrieve 5th highest sal from emp table?..

Answer / aryasen vaikom

SELECT DISTINCT (a.sal)
FROM EMP A
WHERE 5= ( SELECT COUNT (DISTINCT (b.sal))
FROM EMP B
WHERE a.sal<=b.sal )

Is This Answer Correct ?    5 Yes 2 No

How to retrieve 5th highest sal from emp table?..

Answer / venubabu

Select level,Max(sal) from emp
Where level=&level connect by prior sal>sal
group by level;


sql>Enter value for level:5

Is This Answer Correct ?    3 Yes 1 No

How to retrieve 5th highest sal from emp table?..

Answer / arvind patil

select rownum,name,salary
from (select name,salary
from employee
order by salary desc )
where rownum=5;

Is This Answer Correct ?    1 Yes 0 No

How to retrieve 5th highest sal from emp table?..

Answer / lingareddy

select top 1 salary from (select distinct top 5 salary from emp order by salary desc ) a order by salary asc


if u have any doubts in SQL kindly reach with me,

Thanks & Regards,
Lingareddy.S
sabbasani.reddy1@gmail.com

Is This Answer Correct ?    1 Yes 0 No

How to retrieve 5th highest sal from emp table?..

Answer / vasu

select * from emp a where &nth in(select count(b.sal) from
emp b where b.sal<=a.sal);

Is This Answer Correct ?    1 Yes 1 No

How to retrieve 5th highest sal from emp table?..

Answer / jithendranath.g

select z2.sal from emp z1, emp z2
where z2.sal <=z1.sal
group by z2.sal
having count(z2.sal)=&n

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More Oracle General Interview Questions

How remove data files before opening a database?

0 Answers  


How to view existing locks on the database?

0 Answers  


What are the factors that affect OPTIMIZER in choosing an Optimization approach ?

2 Answers  


What is coalesce function?

0 Answers  


How a database is related to tablespaces?

0 Answers  


What is a private synonym?

0 Answers  


How to write a query with an inner join in oracle?

0 Answers  


Explain the use of analyse option in exp command.

0 Answers  


What is a cluster?

2 Answers  


Define oracle database

0 Answers  


What is a cursor variable?

0 Answers  


What query tells you how much space a tablespace named test is taking up, and how much space is remaining?

0 Answers   Infosys,


Categories
  • Oracle General Interview Questions Oracle General (1809)
  • Oracle DBA (Database Administration) Interview Questions Oracle DBA (Database Administration) (261)
  • Oracle Call Interface (OCI) Interview Questions Oracle Call Interface (OCI) (10)
  • Oracle Architecture Interview Questions Oracle Architecture (90)
  • Oracle Security Interview Questions Oracle Security (38)
  • Oracle Forms Reports Interview Questions Oracle Forms Reports (510)
  • Oracle Data Integrator (ODI) Interview Questions Oracle Data Integrator (ODI) (120)
  • Oracle ETL Interview Questions Oracle ETL (15)
  • Oracle RAC Interview Questions Oracle RAC (93)
  • Oracle D2K Interview Questions Oracle D2K (72)
  • Oracle AllOther Interview Questions Oracle AllOther (241)