分类: SQLite/嵌入式数据库
2011-02-23 18:42:37
sql-statement ::= | ATTACH [DATABASE] database-filename AS database-name |
sql-statement ::= | BEGIN [ DEFERRED | IMMEDIATE | EXCLUSIVE ] [TRANSACTION [name]] |
sql-statement ::= | END [TRANSACTION [name]] |
sql-statement ::= |
COMMIT [TRANSACTION [name]] |
sql-statement ::= | ROLLBACK [TRANSACTION [name]] |
comment ::= | SQL-comment | C-comment |
SQL-comment ::= | – single-line |
C-comment ::= | /* multiple-lines [*/] |
sql-statement ::= | COPY [ OR conflict-algorithm ] [database-name .] table-name FROM filename [ USING DELIMITERS delim ] |
sql-statement ::= | CREATE [UNIQUE] INDEX index-name ON [database-name .] table-name ( column-name [, column-name]* ) [ ON CONFLICT conflict-algorithm ] |
column-name ::= | name [ COLLATE collation-name] [ ASC | DESC ] |
sql-command ::= | CREATE [TEMP | TEMPORARY] TABLE table-name (
column-def [, column-def]* [, constraint]* ) |
sql-command ::= | CREATE [TEMP | TEMPORARY] TABLE [database-name.] table-name AS select-statement |
column-def ::= | name [type] [[CONSTRAINT name] column-constraint]* |
type ::= | typename | typename ( number ) | typename ( number , number ) |
column-constraint ::= | NOT NULL [ conflict-clause ] |
PRIMARY KEY [sort-order] [ conflict-clause ] |UNIQUE [ conflict-clause ] | CHECK ( expr ) [ conflict-clause ] |DEFAULT value | COLLATE collation-name |
constraint ::= | PRIMARY KEY ( column-list ) [ conflict-clause ] |
UNIQUE ( column-list ) [ conflict-clause ] |CHECK ( expr ) [ conflict-clause ] |
conflict-clause ::= | ON CONFLICT conflict-algorithm |
sql-statement ::= | CREATE [TEMP | TEMPORARY] TRIGGER trigger-name [ BEFORE | AFTER ]
database-event ON [database-name .] table-name trigger-action |
sql-statement ::= | CREATE [TEMP | TEMPORARY] TRIGGER trigger-name INSTEAD OF database-event ON [database-name .] view-name trigger-action |
database-event ::= | DELETE | INSERT | UPDATE | UPDATE OF column-list |
trigger-action ::= | [ FOR EACH ROW | FOR EACH STATEMENT ] [ WHEN expression ]
BEGIN END |
trigger-step ::= | update-statement | insert-statement | delete-statement | select-statement |
sql-command ::= | CREATE [TEMP | TEMPORARY] VIEW [database-name.] view-name AS select-statement |
sql-statement ::= | DELETE FROM [database-name .] table-name [WHERE expr] |
sql-command ::= | DETACH [DATABASE] database-name |
sql-command ::= | DROP INDEX [database-name .] index-name |
sql-command ::= | DROP TABLE [database-name.] table-name |
sql-statement ::= | DROP TRIGGER [database-name .] trigger-name |
sql-command ::= | DROP VIEW view-name |
sql-statement ::= | EXPLAIN sql-statement |
expr ::= | expr binary-op expr |
expr like-op expr | unary-op expr | ( expr ) | column-name | literal-value | expr ISNULL | expr [NOT] IN ( value-list ) | expr [NOT] IN [database-name .] table-name | ( select-statement ) | |
like-op ::= | LIKE | GLOB | NOT LIKE | NOT GLOB |
sql-statement ::= | INSERT [OR conflict-algorithm] INTO [database-name .] table-name [(column-list)] VALUES(value-list) |
INSERT [OR conflict-algorithm] INTO [database-name .] table-name [(column-list)] select-statement |
conflict-clause ::= | ON CONFLICT conflict-algorithm |
conflict-algorithm ::= | ROLLBACK | ABORT | FAIL | IGNORE | REPLACE |
sql-statement ::= | REPLACE INTO [database-name .] table-name [( column-list )] VALUES ( value-list ) |
REPLACE INTO [database-name .] table-name [( column-list )] select-statement |
sql-statement ::= |
SELECT [ALL | DISTINCT] result [FROM table-list]
[WHERE expr] [GROUP BY expr-list] [HAVING expr] [compound-op select]* [ORDER BY sort-expr-list] |
result ::= | result-column [, result-column]* |
result-column ::= | * | table-name . * | expr [ [AS] string ] |
table-list ::= | table [join-op table join-args]* |
table ::= | table-name [AS alias] | ( select ) [AS alias] |
join-op ::= | , | [NATURAL] [LEFT | RIGHT | FULL] [OUTER | INNER | CROSS] JOIN |
join-args ::= | [ON expr] [USING ( id-list )] |
sort-expr-list ::= | expr [sort-order] [, expr [sort-order]]* |
sort-order ::= | [ COLLATE collation-name ] [ ASC | DESC ] |
compound_op ::= | UNION | UNION ALL | INTERSECT | EXCEPT |
sql-statement ::= | UPDATE [ OR conflict-algorithm ] [database-name .] table-name
SET assignment [, assignment]*[WHERE expr] |
assignment ::= | column-name = expr |
sql-statement ::= | VACUUM [index-or-table-name] |