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


Anybody can tell me, how do we find second largest emp
salary from emp table.. Thanks in advance ...

Answers were Sorted based on User's Feedback



Anybody can tell me, how do we find second largest emp salary from emp table.. Thanks in advance ....

Answer / raj

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

Is This Answer Correct ?    31 Yes 1 No

Anybody can tell me, how do we find second largest emp salary from emp table.. Thanks in advance ....

Answer / selvaraj anna university coe

Oracle 10g Using : Find 2nd Highest Salary?

SELECT * FROM emp e WHERE 2=(SELECT COUNT(DISTINCT salary)
FROM emp x
WHERE x.salary >= e.salary);

Answer :

EMP_NO EMP_NAME SALARY
--------- ------------------------- ---------
107 SARABOOT 550000

Is This Answer Correct ?    10 Yes 1 No

Anybody can tell me, how do we find second largest emp salary from emp table.. Thanks in advance ....

Answer / mahaboob

I would say that Raj has given the correct answer in general.

In most cases the interviewer restricts the parameter to be
written in the query as it might effect the performance.

Is This Answer Correct ?    3 Yes 0 No

Anybody can tell me, how do we find second largest emp salary from emp table.. Thanks in advance ....

Answer / amitkumar

Select TOP 1 salary from (select Distinct TOP 2 salary from
employee orderby salary desc)

Is This Answer Correct ?    5 Yes 2 No

Anybody can tell me, how do we find second largest emp salary from emp table.. Thanks in advance ....

Answer / samad

Dear
here i am sending new ans u can give the value in parameter

SELECT SAL,NO FROM(
SELECT SAL ,ROWNUM NO FROM
(SELECT DISTINCT SAL FROM EMP ORDER BY SAL DESC)) WHERE NO=:N


Regards,

Samad

Is This Answer Correct ?    5 Yes 2 No

Anybody can tell me, how do we find second largest emp salary from emp table.. Thanks in advance ....

Answer / hemalatha

Following is the query to find the nth maximum salary:

select * from emp
where sal=(select distinct(sal) from emp a
where &n=(select count(sal)from emp
where sal>=a.sal;))

Is This Answer Correct ?    2 Yes 1 No

Anybody can tell me, how do we find second largest emp salary from emp table.. Thanks in advance ....

Answer / keerthi

select(max(salary)
from employee
where sal>max salary&salary<max salary-1;
if you say no to my answer plz correct me.

Is This Answer Correct ?    0 Yes 0 No

Anybody can tell me, how do we find second largest emp salary from emp table.. Thanks in advance ....

Answer / apsar

select sal from (select sal,count(sal) over order by salary desc c)temp where temp.c=&n;

Is This Answer Correct ?    0 Yes 0 No

Anybody can tell me, how do we find second largest emp salary from emp table.. Thanks in advance ....

Answer / suresh

45000

Is This Answer Correct ?    0 Yes 2 No

Anybody can tell me, how do we find second largest emp salary from emp table.. Thanks in advance ....

Answer / martin

select e.sal from emp e where &2>(select max(count{a.sal})
from emp a where a.sal > e.sal order by desc
)

Is This Answer Correct ?    1 Yes 4 No

Post New Answer

More Oracle General Interview Questions

Please explain the difference between outer join and inner join? With examples would be appreciable..!

6 Answers   IBM,


Please explain me all types of Data models. Also give me the details if each model can have other name.for example:schematic data model is also known as conceptual data model and entity relation data model.

0 Answers  


What is flashback in Oracle?

0 Answers   MCN Solutions,


How to create an oracle testing table?

0 Answers  


can anyone help me ? an index has been done on the primary key of a table. an update operation was performed on that table. now my question is 1> what abt the performance ? means faster or slower due to indexing ? 2> does the operation affect to the primary key constraint ?

2 Answers   Allfon,


How to use null as conditions in oracle?

0 Answers  


How to create a table interactively?

0 Answers  


Name the various constraints used in oracle?

0 Answers  


What is a dynamic performance view in oracle?

0 Answers  


What exactly do quotation marks around the table name do?

0 Answers  


How remove data files before opening a database?

0 Answers  


what is port in oracle? how is it related to database application.

0 Answers  


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)