adspace
Answer Posted / Ajay Pratap Singh Yadav
To fetch alternate records (i.e., every second row) from a table, you can use the ROW_NUMBER() function in SQL. Here's an example for MySQL: SELECT * FROM your_table WHERE ROW_NUMBER() OVER(ORDER BY id) % 2 = 1; Replace 'your_table' with the name of your table and 'id' with the primary key column name.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
what are aggregate and scalar functions? : Sql dba
If a cursor is open, how can we find in a pl/sql block?
Can we rollback truncate?
Does group by remove duplicates?
Can we use distinct and group by together?
what is schema? : Sql dba
Do we need to rebuild index after truncate?
what is bcp? When does it used? : Sql dba
Hi am new to PLSQL & facing problems in writing code like in SP, Functions, so any one having some SP coding with in depth explanation please share with me my Email ID suvarnaatsuvarna@rediffmail.com Or taking tanning on this please do contact me
What is the current version of sql?
what are all the common sql function? : Sql dba
what is sql server agent? : Sql dba
how to start mysql server? : Sql dba
how to use regular expression in pattern match conditions? : Sql dba
how to escape special characters in sql statements? : Sql dba