On Jun 12, 2005, at 5:22 AM, Ken & Deb Allen wrote:

1. CREATE TABLE Table1 (PKey INTEGER UNIQUE NOT NULL, Col2 VARCHAR (32) NOT NULL, Col3 VARCHAR(64) NULL);
Creates a separate index.


2. CREATE TABLE Table2 (PKey INTEGER NOT NULL PRIMARY KEY, Col2 VARCHAR(32) NOT NULL, Col3 VARCHAR(64) NULL);

No separate index, this is the most efficient case. (NOT NULL is redundant, PRIMARY KEY implies this)


3. CREATE TABLE Table3 (PKey INTEGER NOT NULL, Col2 VARCHAR(32) NOT NULL, Col3 VARCHAR(64) NULL, PRIMARY KEY(PKey));


No separate index. (NOT NULL again redundant)

"select * from sqlite_master where type = 'index';" will show you what you want to know.
I have not used the first form, and the latter is the form that I tend to use since it is the most 'universal' across different database packages.

-ken


--
Gé Weijers
e-mail: [EMAIL PROTECTED]


Reply via email to