affiliate marketing Interview Qns: Can one retrieve only the Nth row from a table?

Monday, October 25, 2010

Can one retrieve only the Nth row from a table?

SELECT * FROM t1 a WHERE n = (SELECT COUNT(rowid)
FROM t1 b WHERE a.rowid >= b.rowid);


SELECT * FROM (SELECT ENAME,ROWNUM RN FROM EMP WHERE ROWNUM < style=""> WHERE RN = 100;


SELECT * FROM emp WHERE rownum=1 AND rowid NOT IN (SELECT rowid FROM emp WHERE rownum <>

there is no explicit row order in a relational database. However, this query is quite fun and may even help in the odd situation.

No comments:

Post a Comment