Reputation: 19
SELECT *
FROM emp
WHERE (ROWID,0) IN (SELECT ROWID, MOD(ROWNUM,4)
FROM emp);
What is use of Rowid,0 in above query ? i checked the documentation but could not find details about this.
Upvotes: 0
Views: 178
Reputation: 879
SELECT MOD(1,4) FROM dual returns 1
SELECT MOD(2,4) FROM dual returns 2
SELECT MOD(3,4) FROM dual returns 3
SELECT MOD(4,4) FROM dual returns 0
So the above query selects every row which returns the value 0 for the MOD functions, which is basically the 4th row.
Upvotes: 1