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 / bibin__edappal

select salary from empTable where salary = (select
max(salary )from empTable where salary < (select max(salary
) from empTable))

OR

select salary from empTable where salary = (select
max(salary )from empTable where salary NOT IN (select
max(salary ) from empTable))

Is This Answer Correct ?    0 Yes 0 No

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

Answer / chandu

select max(sal)from table name where sal<(select max sal
from table name)

Is This Answer Correct ?    0 Yes 0 No

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

Answer / rajat

select max(sal) from table_name sal<(select max(sal)
from table_name)

Is This Answer Correct ?    0 Yes 0 No

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

Answer / abhi

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

OR

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

OR

select max(sal)from emp where sal != (select max(sal)from emp)

Is This Answer Correct ?    1 Yes 1 No

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

Answer / rajiv singh

select max(department_id) from departments where
department_id <(select max(department_id) from departments);

Is This Answer Correct ?    0 Yes 0 No

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

Answer / harish

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

Is This Answer Correct ?    0 Yes 0 No

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

Answer / hari chaudhary

All My friend use this query then good result of your sql
database find in second or Third last data find.....

Select distinct(salary) From employee E1 Where
(n-1) = (Select Count(Distinct(E2.salary)) From employee E2
Where E2.salary > E1.salary)

Is This Answer Correct ?    0 Yes 0 No

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

Answer / jitendra kumar

select salary from (select salary from emp ordery by salary
(dese) where rownum>=2;

Is This Answer Correct ?    0 Yes 0 No

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

Answer / subrat

SELECT MAX(Sal) FROM EMP WHERE Sal < (SELECT MAX(Sal) FROM EMP)

Is This Answer Correct ?    0 Yes 0 No

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

Answer / sagar

if the salary is simple non-duplicate salary, you can use
the below queries:

select max(sal) from emp where sal != (select max(sal) from emp)

you can also try

select sal from (select * from emp order by sal desc) where
rownum = 2

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More SQL PLSQL Interview Questions

How do I view a sql trace file?

0 Answers  


what is the difference between the query and corelated query

8 Answers   HSBC, IBM, TCS, Xenosoft,


what is the difference between group by and order by in sql? : Sql dba

0 Answers  


please explain database architecture..

1 Answers   Infosys,


How do I view an execution plan in sql?

0 Answers  


1 SELECT a.field1, b.field2, c.field3, d.field4 2 FROM atable a, atable b, ctable c, dtable d 3 ? 4 ORDER BY 1 What is the minimum number of joins that must be specified on line 3 in the sample code above to properly link the tables? Notice that the table "atable" is aliased twice: once as "a" and once as "b." 1. One join 2. Two joins 3. Three joins 4. Four joins 5. Five joins

6 Answers   Sonata,


What is sql and db2?

0 Answers  


What is type and rowtype in pl sql?

0 Answers  


how instead of triger is helpful for mutating tables errors handlling ?

2 Answers   Oracle,


what is the command used to fetch first 5 characters of the string? : Sql dba

0 Answers  


What is a sql driver?

0 Answers  


How to call DDL statements from pl/sql?

5 Answers  


Categories