On 2 Nov 2015, at 7:45am, Gerald Bauer <gerald.bauer at gmail.com> wrote:

>   I prefer the "simpler" non-generic way e.g. spelling out all fields e.g.:
> 
> CREATE TABLE "facts"(
>  "id"   INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
>  "code" varchar(255) NOT NULL,

A couple of quick comments:

First, there are not variable-length text fields in SQLite.  That field will be 
interpreted as TEXT and you cannot depend on truncation to 255 characters.  I 
would advise you to change the above to

"code" TEXT NOT NULL

since this is the result you will get anyway.

Second, although SQLite supports quoted column names, they're rather 
non-standard these days.  SQLite can cope with double-quotes, MySQL can cope 
with ticks (back-apostrophes), MS SQL copes with brackets, etc..  Since every 
SQL engine copes well with unescaped names, e.g.

code TEXT NOT NULL

, and you don't use punctuation in your names, you might prefer to use that.

Simon.

(I am uncomfortably aware that one of my pieces of advice is to use a SQLite 
rule instead of a general standard, and the other is to use a general standard 
instead of a SQLite rule.  I resort to Emerson: "A foolish consistency is the 
hobgoblin of little minds.")

Reply via email to