> I have been caught out by this - I read what the documentation says but
> just did not carefully understand it.  What the above means is this:
> * You do an insert in the sequence as above, you say that I should not
> sort by id ASC because you want it in insertion order

> * You decide then to do a sort by ROWID ASC - expecting that ROWID is
> maintaining the sequence since when you do a general SELECT * from
> mytable; you often get it in insertion sequence (if I'm not wrong).

It may *appear* that a "select * from table" returns rows in insertion order 
however, this is not the case.  A table-scan traverses, inorder, the btree 
structure which comprises the table.  The key to this b-tree is the ROWID and 
the rest of the table row is the payload.  "select * from table" will return 
the rows in insertion order if and only if you have not every explicitly set a 
ROWID when inserting a row, and if and only if you have never overflowed the 
ROWID.

An SQL database is not a sequential file and the concept of "Record Number" as 
in a sequential file simply does not apply.

---
()  ascii ribbon campaign against html e-mail
/\  www.asciiribbon.org




_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to