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 empty your oracle recycle bin?
SELECT THE RECORDS FROM 3 TABLES LIKE(T1,T2,T3) AND HOW CAN WE INSERT THAT RECORD IN ANOTHER TABLE LIKE(T4)?
When do I need to use a semicolon vs a slash in oracle sql?
What is the cache hit ratio, what impact does it have on performance of an Oracle database and what is involved in tuning it?
what is load balancing and what u have used to do this?(sql loader)
how can db_files > maxdatafiles since db_files is for instance and the later is for database
Please explain me all types of Data models. Also give me the details if each model can have other name.for example:schematic data model is also known as conceptual data model and entity relation data model.
Can we use bind variables in oracle stored procedure?
What is the recommended interval at which to run statspack snapshots, and why?
what is the difference between sql& oracle?
How i can handle exception in large code like 1000 line without distrubing the code or without exception handler sction?
How to find the date and time of last updated table?