Igor Mironchick <[EMAIL PROTECTED]>
wrote:
Can anybody explain me for what PRIMARY KEY needed?
PRIMARY KEY is roughly equivalent to UNIQUE NOT NULL. That is, you get
an index on this column, the database enforces that no two rows have the
same value, and doesn't allow NULLs in this column.
In addition, a column declared as INTEGER PRIMARY KEY has a special
meaning in SQLite. For more details, see http://sqlite.org/autoinc.html
For example, is
there some pluses using PRIMARY KEY insted of a simple INTEGER column
(when I connect two tables by values of this column in SELECT
queries)?
An index would likely make this operation faster (of course, you can
explicitly create an index on plain INTEGER column).
And is PRIMARY KEY auto increment his value when inserting
new value in a table?
Yes, a unique value will be automatically generated for an INTEGER
PRIMARY KEY column if none is specified in the INSERT statement.
I mean can I use INTEGER PRIMARY KEY and set
him by himself?
Yes. Note that you will get an error if this value already exists in the
table.
And for what a INDEX?
http://en.wikipedia.org/wiki/Index_%28database%29
Igor Tandetnik
-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------