how to find 5th row ?
Answers were Sorted based on User's Feedback
Answer / sunil bisht
Hi Shajin
above answere is perfectly correct.
but i have one more method..
select * from emp where rownum<6 minus select * from emp
where rownum<=4;
| Is This Answer Correct ? | 22 Yes | 3 No |
Answer / subhani
some of above have used corelated subqueries but it is not
recommonded to use.
best way is
select * from emp where rownum<=5
minus
select * from emp where rownum<5;
| Is This Answer Correct ? | 11 Yes | 1 No |
Answer / suresh babu
SELECT * FROM t1 a
WHERE 5 = (SELECT COUNT(rowid)
FROM t1 b
WHERE a.rowid >= b.rowid);
This Query,Which is used to find 5 record from Table.
| Is This Answer Correct ? | 10 Yes | 5 No |
Answer / swastik
SELECT * FROM
(
SELECT ROWNUM Rn, E1.*
FROM Emp
)
WHERE RN = 5
/
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / suresh babu
select * from table_name tn1 where 5 = (select count(rowid)
from table_name tn2 where tn1.rowid >= tn2.rowid);
This query,which is display the 5th row in table.
| Is This Answer Correct ? | 2 Yes | 2 No |
Answer / bikash khuntia
Hi Freinds,
I have seen the solution given. But in oracle if you will
select records from a table then everytime you will not
fetch the same squence of records. it will come
differently.Hence we cannot select the 5th row from a table
in oracle.
But the solution is that we can select 5th row from a table
in arranging the records in ascending or descending way by
a column and then select the 5th row as below:-
SELECT BIKK.SAL FROM
(SELECT ROWNUM RW,BIK.SAL SAL FROM (SELECT SAL FROM
TEMP_SAL ORDER BY SAL) BIK) BIKK
WHERE rw=6
| Is This Answer Correct ? | 0 Yes | 1 No |
Answer / alok narayan
1.
select * from emp e1 where 5 =( select count(rowid) from
emp e2 where e1.rowid >= e2.rowid) ;
| Is This Answer Correct ? | 1 Yes | 3 No |
Answer / krish
select * from(select * from emp order by rowid desc)where
rownum=5;
| Is This Answer Correct ? | 1 Yes | 7 No |
How many clustered indexes can be created on a table?
Can We write bulk collect statement in triggers?
Table Student has 3 columns,Student_id,Student_Name & Course_Id. Table Course has 2 columns, Course_Id & Course_Name.Write a query to listdown all the Courses and number of student in each course.
What is pragma in pl sql?
What is audit logout in sql profiler?
What does sign mean sql?
What is not null in sql?
Do prepared statements prevent sql injection?
What is an implicit commit?
suppose I have two table one Emp and other is dpt. Emp table has a field ,dept id,name ,sal and dpt table has a field dept id,dept name. Now I want to find out the emplyee list whose sal is between 2000-3000 from dept x.
7 Answers Geometric Software, IBM,
HOW TO PRINT * ** *** **** ***** BY USING SQL QUERY? (MAY BE USING SCRIPT)
Is like operator in sql case sensitive?
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)