Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I select rows by range? [duplicate]

Tags:

sql

sqlite

Possible Duplicate:
Select statement in SQLite recognizing row number

For example, SELECT * FROM table WHERE [row] BETWEEN x AND y

How can this be done? I've done some reading but haven't found anything specifically correct.

Imagine a list where you want results paged by an X amount of results, so for page 10 you would need results from rows 10 * X to 10 * X + X. Rather than display ALL results in one go

like image 587
rtheunissen Avatar asked Dec 28 '12 11:12

rtheunissen


People also ask

How do I compare multiple rows in Excel for duplicates?

Navigate to the "Home" option and select duplicate values in the toolbar. Next, navigate to Conditional Formatting in Excel Option. A new window will appear on the screen with options to select "Duplicate" and "Unique" values. You can compare the two columns with matching values or unique values.

How do I Select duplicate rows?

To select duplicate values, you need to create groups of rows with the same values and then select the groups with counts greater than one. You can achieve that by using GROUP BY and a HAVING clause.

How do you duplicate specific rows in Excel?

Right-click a row or column below or to the right of where you want to move or copy your selection, and then do one of the following: When you are moving rows or columns, click Insert Cut Cells. When you are copying rows or columns, click Insert Copied Cells.


1 Answers

For mysql you have limit, you can fire query as :

SELECT * FROM table limit 100` -- get 1st 100 records SELECT * FROM table limit 100, 200` -- get 200 records beginning with row 101 

For Oracle you can use rownum

See mysql select syntax and usage for limit here.

For SQLite, you have limit, offset. I haven't used SQLite but I checked it on SQLite Documentation. Check example for SQLite here.

like image 145
Nandkumar Tekale Avatar answered Sep 22 '22 05:09

Nandkumar Tekale