Write a SQL query to display alternate records from a table?

VijayaTech Labs Blog
For even rows:

SELECT *
FROM (SELECT e.*,MOD(ROWNUM,2) rn FROM employees E)
WHERE rn =0;

For odd rows:

SELECT *
FROM (SELECT e.*,MOD(ROWNUM,2) rn FROM employees E)
WHERE rn =1;

Share this post with your friends

Leave a Comment

Your email address will not be published.

Scroll to Top