You can execute the INSERT OVERWRITE INTO SELECT statement to insert multiple records to a table at a time.

Syntax

INSERT OVERWRITE INTO table_name [(column_name,...)]
SELECT select_statement FROM from_statement   

Precautions

  • The destination table must exist to execute the INSERT OVERWRITE INTO SELECT statement to insert records.
  • The original data in the destination table does not change until the INSERT OVERWRITE INTO SELECT statement is complete. After the INSERT OVERWRITE INTO SELECT statement is complete, the system writes inserted data to the destination table and clears the original data. The INSERT OVERWRITE INTO SELECT statement is used to import large amounts of data. We recommend that you do not use it to import small amounts of data.
  • The INSERT OVERWRITE INTO SELECT statement can be used to insert a specific column. Other columns are set to their default value. If no default value is specified, NULL is specified.
  • When you write data to a table, you cannot use the INSERT OVERWRITE INTO SELECT statement in combination with the INSERT INTO, REPLACE INTO, DELETE, or UPDATE statement. Otherwise, data written in real time is discarded. For more information, see INSERT INTO, REPLACE INTO, DELETE, and UPDATE.