On Thu, 20 Nov 2008 15:25:35 +0100, Christophe Leske <[EMAIL PROTECTED]> wrote 
in
General Discussion of SQLite Database <sqlite-users@sqlite.org>:

>
>>> Any chance to spare the ID field and get an index on the rowid for a  
>>> given table?
>> I do not understand the question.  Please rephrase.  Use more words.
>>   
>Most of the ID fields are primary integer keys which also coincident with the 
>value of the rowid for a given table. Yes, you cannot count on it, but as long 
>as you do not change the content of a given table, the value of an ID field 
>declared as a integer primary key is usually the same as the rowid of the 
>record:
>
>rowid=id
>
>I was wondering if there is a cheap way (memorywise) to index the rowid and 
>thus omit the ID field.


http://www.sqlite.org/lang_createtable.html says:

"Specifying a PRIMARY KEY normally just creates a UNIQUE index on the
corresponding columns. However, if primary key is on a single column that has
datatype INTEGER, then that column is used internally as the actual key of the
B-Tree for the table. "

So, in 
CREATE TABLE (
        ID INTEGER PRIMARY KEY,
        ...
); 
, ID is used as / identical with ROWID.

Note: Use the exact words: INTEGER PRIMARY KEY

>Christophe Leske

HTH
-- 
  (  Kees Nuyt
  )
c[_]
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to