"jonwood" <[EMAIL PROTECTED]> wrote in
message news:[EMAIL PROTECTED]
> I'm creating SQLite tables from code and could use help with the
> following issues:
>
> 1. I'd like some tables to include foreign keys. These should be
> indexed for speed, but they are neither primary keys or unique. But I
> don't see any option to index a column without it being one of those
> two?

See CREATE INDEX statement.

> 2. In my first attempt at this, I used INT data types for columns. It
> seemed to be working but when I added AUTOINCREMENT, I get an error
> that this is only valid with INTEGER types. When I changed INT to
> INTEGER, it works fine. So what the heck type was used when I
> specified INT?

http://www.sqlite.org/autoinc.html
http://www.sqlite.org/datatype3.html

INT is treated the same as INTEGER, except that a sequence INTEGER 
PRIMARY KEY has a special meaning (and has to be spelled precisely this 
way to acquire said meaning).

> 3. I've been using VARCHAR(n) but see that the SQLite documentation
> only documents TEXT. Can anyone provide tips or a link to help me
> decide which of the two is best?

There's no difference. SQLite accepts both for compatibility with other 
DB systems, and treats them exactly the same. In particular, the column 
of type VARCHAR(n) is _not_ restricted to n characters: it can contain 
strings of any length.

Igor Tandetnik



_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to