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 / m.raghu
answer for 101th record
select * from emp where empno in( select decode
(rownum,&n,empno) from emp);
for 4th highest sal
select distinct sal from(select empno,dense_rank() over
(order by sal desc) rnk from emp) where rnk=&n;
for 5th highest sal give n value=5
for 1-10
select distinct sal from(select empno,dense_rank() over
(order by sal desc) rnk from emp) where rnk<=&n;
| Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
what are the authentication modes in sql server? : Sql dba
When are we going to use truncate and delete?
Write an sql query to select all records from the table?
What is data types in sql?
Is it important to partition hard disk?
1) Synonyms 2) Co-related Subquery 3) Different Jobs in Plsql 4) Explain Plan 5) Wrap 6) Query Optimization Technique 7) Bulk Collect 8) Types of index 9) IF primary key is created then the index created ? 10) Foreign Key 11) Exception Handling 12) Difference Between Delete and Trunc 13) Procedure Overloading 14) Grant Revoke 15) Procedure Argument types. 16) Functions. 17) Joins
Any attempt to navigate programmatically to disabled form in a call_form stack is allowed?
Can we use distinct and group by together?
How can we avoid duplicating records in a query?
Can you have more than one key in a database?
What is difference between rank () row_number () and dense_rank () in sql?
What is sql injection vulnerability?
Why do you partition data?
Can we call procedure in select statement?
Explain alias in sql?