how can we find nth max salary from A table

Answers were Sorted based on User's Feedback



how can we find nth max salary from A table..

Answer / asp

select * from table1 a where (n-1) = (select count(distinct
(sal)) from table1 b where b.sal>a.sal)

Is This Answer Correct ?    15 Yes 5 No

how can we find nth max salary from A table..

Answer / bhaskar reddy

select * from table1 a where(n-1)= (select count(distinct
sal) from table1 b where b.sal>a.sal)

Is This Answer Correct ?    6 Yes 5 No

how can we find nth max salary from A table..

Answer / sivaraman

select * from table1 a where n = (select count(distinct
(sal)) from table1 b where b.sal>a.sal)


n is value of n it should be numeric....

Is This Answer Correct ?    15 Yes 15 No

how can we find nth max salary from A table..

Answer / a

select MAX(Salary) from Employee
WHERE Salary NOT IN (select MAX(Salary) from Employee )

Is This Answer Correct ?    0 Yes 9 No

how can we find nth max salary from A table..

Answer / venkat

select max(sal) from tablename.

Is This Answer Correct ?    7 Yes 51 No

Post New Answer

More DB2 Interview Questions

Explain package in db2 and its advantages?

0 Answers  


Give the COBOL definition of a VARCHAR field.

2 Answers  


Plan has the optimized access path in it. But is that optimized access path is attained or known

1 Answers   IBM,


db2 maintains information about the data... a.in tables. b.in a set of tables known as db2 catalog. c.in db2 database. d.none of the above.

1 Answers  


What is subquery ?

6 Answers  






What is db2 connect?

0 Answers  


What is role in db2?

0 Answers  


what are the max. & min. no. of partitions allowed in a partition tablespace?

2 Answers   IBM,


What is the connection string to connect to the DB2 Database ?

0 Answers   MCN Solutions,


wht are the restrictions for union ?

2 Answers   CTS,


What is the difference between Primary key and unique index?

6 Answers  


in the CURSOR declare statement, if i am using an where clause and trying to compare the value with a host-varialble. EXEC SQL DECLARE C1 CURSOR FOR SELECT DEPTNO, DEPTNAME, MGRNO FROM DEPARTMENT WHERE ADMRDEPT = :ADM-DEPT Where would i need to provide value to this host-variable in the where clause. how could i pass value to this host-variable to check it.

2 Answers   iGate,


Categories