Naming Conventions


A standard identifier name must begin with a letter or an underscore character, and may contain any number of alphanumeric characters or underscores. No other characters can be used. There is no enforced upper limit on the length of an identifier name. Names can be as long as you like, but don't make them so long that you dread having to type them in full each time.

Square brackets or double quotes can be used to indicate a non-standard identifier name to the SQLite parser. Identifier names enclosed in this way can include characters other than the underscore, including spaces and even other square brackets, and this also allows you to use SQL keywords as identifiers.

Note

It is not generally a good idea to use non-standard identifier names in your database; although, square brackets can still be used around standard identifier names without consequence if you are familiar with this syntax from SQL Server or Microsoft Access.


Reserved Keywords

Tables C.1 through C.3 list the reserved keywords in SQLite. Table C.1 shows the fallback keywords, which can be used as identifiers without being delimited.

Table C.1. Fallback Keywords in SQLite

ABORT

AFTER

ASC

ATTACH

BEFORE

BEGIN

DEFERRED

CASCADE

CLUSTER

CONFLICT

COPY

CROSS

DATABASE

DELIMITERS

DESC

DETACH

EACH

END

EXPLAIN

FAIL

FOR

FULL

IGNORE

IMMEDIATE

INITIALLY

INNER

INSTEAD

KEY

LEFT

MATCH

NATURAL

OF

OFFSET

OUTER

PRAGMA

RAISE

REPLACE

RESTRICT

RIGHT

ROW

STATEMENT

TEMP

TEMPORARY

TRIGGER

VACUUM

VIEW

    


Table C.3. System Object Names in SQLite

_ROWID_

MAIN

OID

ROWID

SQLITE_MASTER

SQLITE_TEMP_MASTER

    


Table C.2 shows the normal keywords, which can only be used as identifier names if they are contained in square brackets or double quotes.

Table C.2. Normal Keywords in SQLite

ALL

AND

AS

BETWEEN

BY

CASE

CHECK

COLLATE

COMMIT

CONSTRAINT

CREATE

DEFAULT

DEFERRABLE

DELETE

DISTINCT

DROP

ELSE

EXCEPT

FOREIGN

FROM

GLOB

GROUP

HAVING

IN

INDEX

INSERT

INTERSECT

INTO

IS

ISNULL

JOIN

LIKE

LIMIT

NOT

NOTNULL

NULL

ON

OR

ORDER

PRIMARY

REFERENCES

ROLLBACK

SELECT

SET

TABLE

THEN

TRANSACTION

UNION

UNIQUE

UPDATE

USING

VALUES

WHEN

WHERE

 


Table C.3 shows the names of some system objects in SQLite that can only be used as an identifier name for a different type of object.



    SQLite
    SQLite
    ISBN: 067232685X
    EAN: 2147483647
    Year: 2004
    Pages: 118
    Authors: Chris Newman

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net