On Wed, 11 Oct 2006 00:19:28 -0700 (PDT), you wrote:
>Hi,
>
> If I declare my column as, "uniqId integer primary key",
> now if I say something like,
> select * from tbl1 where uniqId=x;
>
> Will the uniqId be same as rowid, making my table look ups
> faster as I am using row id only. If not whats the way to
> assign my uniqId to the row id so that my lookups would be
> faster.
http://www.sqlite.org/lang_createtable.html by drh>
"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.
This means that the column may only hold unique integer values.
(Except for this one case, SQLite ignores the datatype
specification of columns and allows any kind of data to be put
in a column regardless of its declared datatype.)
If a table does not have an INTEGER PRIMARY KEY column, then the
B-Tree key will be a automatically generated integer. The B-Tree
key for a row can always be accessed using one of the special
names "ROWID", "OID", or "_ROWID_". This is true regardless of
whether or not there is an INTEGER PRIMARY KEY. An INTEGER
PRIMARY KEY column can also include the keyword AUTOINCREMENT.
The AUTOINCREMENT keyword modified the way that B-Tree keys are
automatically generated. Additional detail on automatic B-Tree
key generation is available separately."
> ...
> Chetana.
I hope this helps.
--
( Kees Nuyt
)
c[_]
-
To unsubscribe, send email to [EMAIL PROTECTED]
-