Updated on 2024-11-29 GMT+08:00

Inserting Data

This topic describes the basic SQL syntax and example statements for inserting table data.

Basic Syntax

INSERT INTO table_name

[ PARTITION (p1, ...) ]

[ WITH LABEL label]

[ (column [, ...]) ]

[ [ hint [, ...] ] ]

{ VALUES ( { expression | DEFAULT } [, ...] ) [, ...] | query }

Example

  • Insert multiple rows of data into the test table at a time.

    INSERT INTO test VALUES (1, 2), (3, 4);

  • Import the result of a query statement to the test table.

    INSERT INTO test (c1, c2) SELECT * from test2;