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

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;

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top