-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 5/22/2014 5:23 PM, RSmith wrote:
> On 2014/05/22 17:25, Humblebee wrote:
>> I would like to order the grouping of the Persons in a
>> particular order. So the sequence of the result is based on the
>> TeamPersonTable's order field.
> 
> First a word of warning - Please do not use column names that are
> the same as SQL keywords, such as "Order"... I took the liberty of
> renaming the new column to "orderId" because of this.

I tend to use the term "sort" as a column name when specifying the
sort order, unless there's a more appropriate domain-specific term
available.

Regarding keywords being column (or table!) names: I'm working on an
application that models an existing system which uses a concept
(unrelated to SQL, it actually has to do with music) called a table.
So I'm fairly well stuck using that word to name the table and a
couple related things such as foreign keys.

The solution here (aside from inventing an unfamiliar term or
intentionally misspelling table) is to surround the word in double
quotes to force SQLite to not interpret it as a keyword.  For example:

CREATE TABLE "table"
(id INTEGER PRIMARY KEY, a, b, c);

CREATE TABLE phrase
(id INTEGER PRIMARY KEY, "table" REFERENCES "table", a, b, c);

So that's what double quotes means.  Single quotes, on the other hand,
are used to enter string literals.

- -- 
Andy Goth | <andrew.m.goth/at/gmail/dot/com>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (MingW32)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJTf5PvAAoJELtYwrrr47Y4HEkIAIIlRFUxlOk+209QEf4TnXqt
AEjqE9apHT9ROKSK3bHU8oWGbaRxggYtBQmV+VJgmVFLTTAnRv7Dp2H3sS/KOLB+
WvHDoqvRqp7nCmVDEEH8J9toDL8F6AOJLbo31YMqHWYFYaGcYMJofiCc/SQJAU+E
AHkkUDT33qLWy0hB4crpNSdg0gHIcFqwytwSr9SejgITlsGUJc4SpZkxM2GYLiCQ
a33FRg5bla27Gtumt1rdw0sahkOoTlx/fgVhtxcnoHc0kiLL3p5P472lwphd0aQO
wceYK8fzkxEjUY2LsnKERQPsf1JtCwOXVZaCQ6G9LM88ofsdZ0qrbRfJ5dM7n1Q=
=iDnC
-----END PGP SIGNATURE-----
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to