Updated on 2025-08-12 GMT+08:00

Inserting Data

This section describes the basic syntax and usage of the SQL statements for inserting table data in a Doris cluster.

Basic Syntax

INSERT INTO table_name
[ PARTITION (p1, ...) ]
[ WITH LABEL label]
[ (column [, ...]) ]
[ [ hint [, ...] ] ]
{ VALUES ( { expression | DEFAULT } [, ...] ) [, ...] | query }

Usage Example

  • Create table test.
    CREATE TABLE test
    (
    c1 TINYINT,
    c2 DECIMAL(10, 2) DEFAULT "10.5",
    )
    COMMENT "table comment"
    DISTRIBUTED BY HASH(k1) BUCKETS 32;
  • Create table test2.
    CREATE TABLE test2 like test;
  • Insert multiple rows of data into the test table at a time.
    INSERT INTO test VALUES (1, 2), (3, 4);
  • Check whether data is inserted into test2.
    SELECT * from test2;
  • Import the result of a query statement to the test table.
    INSERT INTO test (c1, c2) SELECT * from test2;