Small. Fast. Reliable.
Choose any three.

SQLite里的SQL
SQL As Understood By SQLite

[Top]

INSERT

insert-stmt:

syntax diagram insert-stmt

expr:

select-stmt:

with-clause:

INSERT语句有三种基本结构。
The INSERT statement comes in three basic forms.

冲突选项可以从给定的标准约束冲突解决算法中选择一个在INSERT命令中使用。详细信息参见ON CONFLICT。为了兼容MySQL,解析器允许使用一个单独的关键字REPLACE 作为"INSERT OR REPLACE"的别名。

The optional conflict-clause allows the specification of an alternative constraint conflict resolution algorithm to use during this one INSERT command. See the section titled ON CONFLICT for additional information. For compatibility with MySQL, the parser allows the use of the single keyword REPLACE as an alias for "INSERT OR REPLACE".

可选的"database-name." 前缀只有顶级的INSERT语句支持。这个表名在CREATE TRIGGER语句中的INSERT语句中是不合规的。同样的, "DEFAULT VALUES"结构也只在顶级INSERT语句中支持,触发器中的INSERT语句是不支持的。
The optional "database-name." prefix on the table-name is support for top-level INSERT statements only. The table name must be unqualified for INSERT statements that occur within CREATE TRIGGER statements. Similarly, the "DEFAULT VALUES" form of the INSERT statement is supported for top-level INSERT statements only and not for INSERT statements within triggers.