how to write the query to select the rows are in the order
of either 1,3,5,7... or 2,4,6,8,...

Answer Posted / vijayplsql@gmail.com

For 1,3,5,7...

select * from emp where (rowid,1) in (select rowid,mod
(rownum,2) from emp);

For 2,4,6,8,...

select * from emp where (rowid,0) in (select rowid,mod
(rownum,2) from emp);

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain different types of collation sensitivity?

533


explain different types of constraints? : Sql server database administration

518


What is bit data type? What's the information that can be stored inside a bit column?

523


Explain what is the difference between a local and a global temporary table?

516


Do you know exporting and importing utility?

533






Which tcp/ip port does sql server run on? How can it be changed?

575


How can sql server instances be hidden? : sql server security

599


Can we use where and having clause together?

510


What are the differences between “row_number()”, “rank()” and “dense_rank()”?

541


How to create a simple table to test triggers in ms sql server?

514


how we use window authentication connection with sql server.?

632


can you implement data mining in SSRS?

113


What are the advantages of sql azure?

116


Is it safe to delete log files?

526


What are the properties of the relational tables?

494