On Tue, 17 Feb 2009 19:11:56 +0100, Kees Nuyt
<k.n...@zonnet.nl> wrote in sqlite-users@sqlite.org:

I'm not fond of replying to myself, but this needs some
clarification:

>- Try to use integers as primary key, 
>  make it the first column,  << wrong
>  and use the exact code
>  CREATE TABLE tablename (
>     columnname INTEGER PRIMARY KEY,
>     ....
>  );

I looked a little closer: it doesn't have to be the first
column.

The trick is to use the explicitly defined INTEGER PRIMARY
KEY column as the internal ROWID column at the same time. 

In other words, ROWID becomes an automatic alias for your
INTEGER PRIMARY KEY column (or the other way around).

Any other PRIMARY KEY definition will add an extra ROWID
column behind the scenes. That column isn't visible in the
schema. 
Although invisible, it can still be queried using the
appropriate keywords.

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