How to fetch alternate records from a table?
Answer / 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 |
How do I find duplicates in sql?
why not null constraint showing its constraint type as 'c'
What is a primary key? Explain
How does one load ebcdic data? : aql loader
What is minus?
What is a stored procedure ?
What is cascade in sql?
Write a unique difference between a function and a stored procedure.
will function return more than one value how
Is it possible to update views?
What do you mean by stored procedures?
Which join is default?
Oracle (3253)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)