Which statement selects the odd number of records :
Reveal answer
Fill a bubble to check yourself
Which statement selects the odd number of records :
select * from emp where (rowid,1) in (select rowid, mod(rownum,2) from emp);
select * from emp where (rowid,0) in (select rowid, mod(rownum,2) from emp);
select * from emp where (rowid,1) in (select rowid, mod(rownum,1) from emp);
select * from emp where (rowid,1) in (select rowid, mod(rownum,3) from emp);
MOD(rownum,2) returns 1 for odd-numbered rows (1,3,5...) and 0 for even-numbered rows (2,4,6...). By checking if (rowid,1) exists in the subquery that pairs each rowid with mod(rownum,2), we select only rows where rownum is odd. Option B checks for 0 (even rows), Option C uses mod(rownum,1) which is always 0, and Option D uses mod(rownum,3) which doesn't identify odd/even.