Display Odd/ Even number of records?
Answers were Sorted based on User's Feedback
Answer / nishi
Select rownum,empno,ename,salary from emp group by rownum,empno,ename,salary having Mod(rownum,2)=0 -- To display EVEN records.
Select rownum,empno,ename,salary from emp group by rownum,empno,ename,salary having Mod(rownum,2)=1 -- To display ODD records.
| Is This Answer Correct ? | 4 Yes | 0 No |
Answer / swastik mohanty
--TO FIND EVEN NUMBER
SELECT * FROM Table
WHERE ROWID IN (SELECT DECODE(MOD(ROWNUM, 2), 0, ROWID, NULL) FROM Table);
--TO FIND ODD NUMBER
SELECT * FROM Table
WHERE ROWID IN (SELECT DECODE(MOD(ROWID, 2), 1, ROWID, NULL) FROM Table);
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / shareef
select * from emp where (rowid,0) in(select rowid,mod(rownum,2) from emp);---even
select * from emp where (rowid,1) in(select rowid,mod(rownum,2) from emp);---odd
| Is This Answer Correct ? | 2 Yes | 0 No |
how to get last monday of a month?
What is the function of Optimizer ?
How to create a server parameter file?
What is a dead lock in oracle?
What are the various types of snapshots ?
What are the types of Database Links ?
what is null value?
What is blob datatype?
a query to select maxmun 3 salaries of employee table
how to find count rows in table without count function?
what is difference between cartesian join & cross join even they give same result?
What is a recycle bin in oracle?