find out the third highest salary?

Answers were Sorted based on User's Feedback



find out the third highest salary?..

Answer / swaminathan

select *
from (select distinct sal from emp order by sal desc)
where rownum <= 3

Is This Answer Correct ?    9 Yes 13 No

find out the third highest salary?..

Answer / rakesh sharma

order by
credit desc

Is This Answer Correct ?    0 Yes 4 No

find out the third highest salary?..

Answer / order by sal

select (sal) as sal from employee

Is This Answer Correct ?    0 Yes 4 No

find out the third highest salary?..

Answer / amitabh sharma

Here are 2 queries for finding 3rd highest salary:

select * from emp e
where 3 = (select count(sal) from emp
where e.sal < sal);


SELECT * FROM
(
SELECT Ename, SAL, dense_Rank() OVER (ORDER BY SAL DESC )
RANKNEW FROM EMP)
WHERE RANKNEW = 3

Regards,
Amitabh Sharma

Is This Answer Correct ?    1 Yes 5 No

find out the third highest salary?..

Answer / ruchira

select sal from emp
where sal =
(select sal from
(select distinct sal from emp OrderBy sal desc)
[table alias] where rownum < 4 )

Is This Answer Correct ?    1 Yes 5 No

find out the third highest salary?..

Answer / sapna rawal

SELECT TOP 1 salary
FROM (
SELECT DISTINCT TOP n salary
FROM employee
ORDER BY salary DESC)
ORDER BY salary ;

n=3.In this case.

Is This Answer Correct ?    1 Yes 5 No

find out the third highest salary?..

Answer / anirban mitra

SELECT MAX(SAL) FROM EMP WHERE SAL NOT IN (SELECT MAX(SAL)
FROM EMP UNION SELECT MAX(SAL) FROM EMP WHERE SAL NOT IN
(SELECT MAX(SAL) FROM EMP))

Is This Answer Correct ?    2 Yes 7 No

find out the third highest salary?..

Answer / nagaraj a h

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

Is This Answer Correct ?    0 Yes 5 No

find out the third highest salary?..

Answer / dayaram & sarfaraz (dost)

select a.empno,a.ename,a.sal from emp a
where &n = (select count(distinct(b.sal)) from emp b where
b.sal>= a.sal

Is This Answer Correct ?    0 Yes 5 No

find out the third highest salary?..

Answer / asadullahrao

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

Is This Answer Correct ?    1 Yes 6 No

Post New Answer

More Oracle General Interview Questions

Is the After report trigger fired if the report execution fails ?

0 Answers   Oracle,


What is the difference between pre-select and pre-query?

0 Answers  


what is the difference between no rows returned and null returned?

2 Answers  


Explain oracle insert into command?

0 Answers  


Difference between cartesian join and cross join?

0 Answers  






How to restrict the duplicate records in table valuesets

2 Answers   IBM,


How to create a new oracle data file?

0 Answers  


How to convert the date format from dd/mm/yyyy to mm/dd/yyyy. (for eg). 22/05/2008 to 05/22/2008. when u use to_char(), it tells the month is invalid. how to resolve this problem.tel with eg.

2 Answers   AppLabs,


What is concurrency in oracle?

0 Answers  


I have two tables : COuntry,city I want all the cities in each country.Question on Cross Join.

3 Answers   Microsoft,


What is the usage of merge statement?

0 Answers  


1. what is a single procedure? 2. suppose a view constructed on a query... after that in the master table a column was dropped, then what will be the status of that view? will it be invalid or something else? 3. what is mutating table error? how can you solve that problem? 4. suppose "select * from emp where empno=7788;" is running slow because of what ever the cause it is.. how can you fix it and make the execution faster? 5. will the snapshot of data will be stored in the RAM , where will ir be stored exactly. 6. how to delete 100 tables or 100000 tables' data from the schema without writing delete statement for no.of times. write an sql statement to do that job. 7. suppose a package contains so many cursors, procedures and all.. and we are using such types of procedures so many in a program. so the execution is to be stored all those packages and all to the RAM. utimately it is using many resources for each time execution. how can you reduce the time and using of resources for each execution because the query need to be run many times. how can you tune that? 8. suppose a procudere is there with specs as (a,b,c,d), all of these are IN mode only then while calling them should we pass all the 4 arguments? how to pass (b,c) only.. how ever the specs are wrote in the same order displayed in the above? 9. a function is returning a table type, how to access that function in a select statement? 10. i have a table in database A and another table in database B, how can you access the data of these two tables? write a query for that with dblinks. 11. i have two tables might have 15/20 columns in that.. i wanna send these columns(table) to the front end application for example you are using asp.net by writing a procedure. write that to perform the above job. 12. shall we create a table in the package? 13. shall we create a table in the procedure? 14. suppose i have 10 records, in that i want to select 7th record. write a query for that. cant you use rownum for this? 15. suppose my procedure has got around 20 select statements, in that some three select statements are running very slow. what will you write to detect which queries are running slowly? 16. what fields you use frequently in plan_table? 17. what is pipeline function? explain me with an example. 18. does a unique column can contain more than one null? 19. how many hints are there provided by oracle?

5 Answers   Honeywell,


Categories
  • Oracle General Interview Questions Oracle General (1789)
  • 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)