Query to get max and second max in oracle in one query ?

Answers were Sorted based on User's Feedback



Query to get max and second max in oracle in one query ?..

Answer / braulio

-- that's it

select * from
(select max(salary) from salary)
where rownum = 2

Is This Answer Correct ?    0 Yes 1 No

Query to get max and second max in oracle in one query ?..

Answer / bhamidipati srinivas

select (select max(gross) from employee_dtls),(select max
(gross) as nextmaximum
from employee_dtls where gross<(select max(gross) from
employee_dtls)) from dual

Is This Answer Correct ?    2 Yes 4 No

Query to get max and second max in oracle in one query ?..

Answer / sdfsfsdf

to install .sh files(.exe files)in linux.copy the file
inusr.
open terminal go to usr and type bash ./follwed by file name
(can use tab key)
here.
to unistall java in linux we can use rm command

Is This Answer Correct ?    1 Yes 4 No

Query to get max and second max in oracle in one query ?..

Answer / naveen

select sal from employee where sal >= (select max(sal) from
employee where sal not in (select max(sal) from employee))

Is This Answer Correct ?    7 Yes 14 No

Post New Answer

More Oracle General Interview Questions

Differentiate the standard purchase order,Blanket purchase agreement,Contract purchase agreement,Planned purchase order?

1 Answers  


How do we switch from init.ora file to asp file?

2 Answers  


Given two table employee and department EMP ---------------- empid deptid(fk) Dept --------------------- deptid(pk) deptname que-Write a query to find count of employee in each department. Expected Output- deptid countofEmployee --------------------------- 10 57 20 20 30 15

2 Answers  


I want a table like, no name address addr1 addr2 So i want columns like addr1,addr2 under address column. Can one please answer me. Advance Thanks.

1 Answers   IBM, Wipro,


definition of cluster and non-clustered index?

0 Answers   CSS,






You create a private database link and upon connection, fails with: ORA-2085: connects to . What is the problem? How would you go about resolving this error?

1 Answers  


Can we commit inside a function in oracle?

0 Answers  


Is oracle a language?

0 Answers  


write sql query following source are EmpID, Salary 101 1000 102 2000 103 3000 I want the output format like following empid,sal,composite_sal 101 1000 1000 102 2000 3000 103 3000 6000

4 Answers   TCS,


What does a Control file Contain ?

2 Answers  


what are the default admin accounts in Oracle 10g ?

0 Answers   MCN Solutions,


I'm doing my final year and i ve planned to do an oracle certification , is this the rit tim nd wat's the future scope??

1 Answers  


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)