suppose we have a table in which 200 rows. i want to find
101 row ? what the query....
and how we find 4th and 5th highest salary and 1 to 10
highest salary
Answer Posted / priya
Here It is asked for 101 row. It does not mean ascending or
descending order.
So query goes like this
Ans:select * from emp where rowid in(
select max(no) from
(select rowid as no,sal from emp where rownum<102));
To Find the 101th row higest salary
Ans:
select max(sal) from (
select * from emp order by sal) s where rownum<102;
similarly for 4th highest it is 5 and for (n-1)th sal it is
n.
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What is a field in a database?
When is the explicit cursor used ?
What is java sql drivermanager?
Why use stored procedures?
How do you select unique values in sql?
What is the default isolation level in sql server? : Transact sql
What is percent sign in sql?
What does where 1 1 mean in sql?
what are the different index configurations a table can have? : Sql dba
Is a foreign key always unique?
Why is there a need for sqlcode and sqlerrm variables?
How do I restart sql?
what is try_catch block in procedure
What is coalesce in sql?
Explain the rollback statement?