Re: [sqlite] Insert order maintained?
Ok, I'll use ORDER BY. Thanks! Alberto On 4/17/07, Samuel R. Neff <[EMAIL PROTECTED]> wrote: We got bit by this when moving from MSSQL 2000 to MSSQL 2005. MSSQL returned rows by default in PK order and one of our former developers depended on this so when the behavior changed in MSSQL 2005 (which is fine 'cause it wasn't documented or expected behavior) our app broke in unexpected ways. With any db it's always best to specify an ORDER BY if you care about the order. Sam --- We're Hiring! Seeking a passionate developer to join our team building products. Position is in the Washington D.C. metro area. If interested contact [EMAIL PROTECTED] -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 17, 2007 11:18 AM To: sqlite-users@sqlite.org Subject: Re: [sqlite] Insert order maintained? > I know this is the behavior for MySQL, but not sure about SQLite. I'v heard about some version of mysql that didn't return rows in the same order (but haven't seen it myselt). So unless this behaviour is documented in mysql manual, it's not a good idea to rely on this. Actually I'v seen only 1 database that allways returns rows in random order, but it doesn't mean that other databases guarantee anything. -- Jak bedzie wygladac koniec swiata? >>> Zobacz >>> http://link.interia.pl/f1a38 - To unsubscribe, send email to [EMAIL PROTECTED] - -- Alberto Simões - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] Insert order maintained?
> I know this is the behavior for MySQL, but not sure about SQLite. I'v heard about some version of mysql that didn't return rows in the same order (but haven't seen it myselt). So unless this behaviour is documented in mysql manual, it's not a good idea to rely on this. Actually I'v seen only 1 database that allways returns rows in random order, but it doesn't mean that other databases guarantee anything. -- Jak bedzie wygladac koniec swiata? >>> Zobacz >>> http://link.interia.pl/f1a38 - To unsubscribe, send email to [EMAIL PROTECTED] -
RE: [sqlite] Insert order maintained?
We got bit by this when moving from MSSQL 2000 to MSSQL 2005. MSSQL returned rows by default in PK order and one of our former developers depended on this so when the behavior changed in MSSQL 2005 (which is fine 'cause it wasn't documented or expected behavior) our app broke in unexpected ways. With any db it's always best to specify an ORDER BY if you care about the order. Sam --- We're Hiring! Seeking a passionate developer to join our team building products. Position is in the Washington D.C. metro area. If interested contact [EMAIL PROTECTED] -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 17, 2007 11:18 AM To: sqlite-users@sqlite.org Subject: Re: [sqlite] Insert order maintained? > I know this is the behavior for MySQL, but not sure about SQLite. I'v heard about some version of mysql that didn't return rows in the same order (but haven't seen it myselt). So unless this behaviour is documented in mysql manual, it's not a good idea to rely on this. Actually I'v seen only 1 database that allways returns rows in random order, but it doesn't mean that other databases guarantee anything. -- Jak bedzie wygladac koniec swiata? >>> Zobacz >>> http://link.interia.pl/f1a38 - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] Insert order maintained?
Additionally, note that if you use ORDER BY, and it _is_ in the indicated order already, then sqlite will optimize the ORDER BY away entirely. So use ORDER BY. -scott On 4/17/07, Andrew Finkenstadt <[EMAIL PROTECTED]> wrote: The order of the rows returned by a select that does not have an ORDER BY clause is guaranteed by the standard to be in any arbitrary order, even from one execution to another due to changes in the underlying data, index statistics, amount of memory available, or even the phase of the moon. Use an ORDER BY clause if order matters to you. --andy On 4/17/07, Alberto Simões <[EMAIL PROTECTED]> wrote: > > Hi > > I would like to know if the order I get the rows from a select > (without ORDER BY) is the order by which the values were inserted. > > I know this is the behavior for MySQL, but not sure about SQLite. > > THank you > Alberto > -- > Alberto Simões > > > - > To unsubscribe, send email to [EMAIL PROTECTED] > > - > > - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] Insert order maintained?
The order of the rows returned by a select that does not have an ORDER BY clause is guaranteed by the standard to be in any arbitrary order, even from one execution to another due to changes in the underlying data, index statistics, amount of memory available, or even the phase of the moon. Use an ORDER BY clause if order matters to you. --andy On 4/17/07, Alberto Simões <[EMAIL PROTECTED]> wrote: Hi I would like to know if the order I get the rows from a select (without ORDER BY) is the order by which the values were inserted. I know this is the behavior for MySQL, but not sure about SQLite. THank you Alberto -- Alberto Simões - To unsubscribe, send email to [EMAIL PROTECTED] -