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

Syntax

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

Precautions

  • The target table must exist before you can execute the INSERT OVERWRITE INTO SELECT statement to insert the records.
  • Existing data in the target table will not change before the INSERT OVERWRITE INTO SELECT statement is complete. The system writes inserted data to the target table after the INSERT OVERWRITE INTO SELECT statement is complete.
  • If you execute the INSERT OVERWRITE INTO SELECT statement to insert a new record when a duplicate primary key is used, the new record is not inserted.
  • 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 will be discarded. For more information, see INSERT INTO, REPLACE INTO, DELETE, and UPDATE.