Re: [sqlite] SQLITE LIMIT clause

2011-10-10 Thread Richard Hipp
On Mon, Oct 10, 2011 at 10:27 AM, cricketfan wrote: > > SELECT * FROM test WHERE PK1 > 100 LIMIT 100 ORDER BY PK1 ASC; > > Since I have the index on PK1, I believe the rows will be returned in the > ORDER of PK1. Putting an ORDER BY clause will be a no-op. > Do you think

Re: [sqlite] SQLITE LIMIT clause

2011-10-10 Thread Igor Tandetnik
cricketfan wrote: > SELECT * FROM test WHERE PK1 > 100 LIMIT 100 ORDER BY PK1 ASC; > > Since I have the index on PK1, I believe the rows will be returned in the > ORDER of PK1. Putting an ORDER BY clause will be a no-op. Probably, but that's an implementation detail. If

Re: [sqlite] SQLITE LIMIT clause

2011-10-10 Thread cricketfan
SELECT * FROM test WHERE PK1 > 100 LIMIT 100 ORDER BY PK1 ASC; Since I have the index on PK1, I believe the rows will be returned in the ORDER of PK1. Putting an ORDER BY clause will be a no-op. Do you think otherwise? Gabríel A. Pétursson wrote: > > Be aware that if you do not specify an

Re: [sqlite] SQLITE LIMIT clause

2011-10-07 Thread Gabríel A. Pétursson
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

Re: [sqlite] SQLITE LIMIT clause

2011-10-07 Thread Pavel Ivanov
> 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? If your PK1 has no gaps then those two

[sqlite] SQLITE LIMIT clause

2011-10-07 Thread cricketfan
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