Be aware that if you do not specify an ORDER BY clause, the order of the returned rows are undefined. You might not even end up with rows with a primary key even near 100.

What you probably want is:
  SELECT * FROM test WHERE PK1 > 100 LIMIT 100 ORDER BY PK1 ASC;

Other than that, those two queries should be near identical in your situation. Mind the gaps.

On 10/07/2011 03:24 PM, cricketfan wrote:
I have a table called test and it has about 50 columns ( about 200 bytes of
data, all columns combined). I need to browse the entire table periodically.
I have a primary key PK1 which basically is a increasing
sequence number.

SELECT * from test WHERE PK1>100 AND PK1<200;

SELECT * from test WHERE PK1>100 LIMIT 100;

Will the above queries have the same effect? Or will LIMIT behave
differently, i.e. get the entire result set and then return the first 100
from it?

I delete records in my table (it is like a queue implementation) so I might
have gaps in between which is why I want to use the LIMIT clause.

Any advice would be greatly appreciated.

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to