INSERT INTO

Adds rows to the table. If you try to insert a row into a table with an existing primary key value, the operation fails with the PRECONDITION_FAILED error code and the Operation aborted due to constraint violation: insert_pk message returned.

INSERT INTO lets you perform the following operations:

  • Adding constant values using VALUES.

1. INSERT INTO my_table (Key1, Key2, Value1, Value2) 2. VALUES (345987,'ydb', 'Pied piper', 1414); 3. COMMIT;

INSERT - 图1

1. INSERT INTO my_table (key, value) 2. VALUES ("foo", 1), ("bar", 2);

INSERT - 图2 - Saving the SELECT result.

1. INSERT INTO my_table 2. SELECT Key AS Key1, "Empty" AS Key2, Value AS Value1 3. FROM my_table1;

INSERT - 图3