INSERT INTO t1 (a, b) SELECT * FROM (SELECT c, d FROM t2 UNION SELECT e, f FROM t3) AS dt ON DUPLICATE KEY UPDATE b = b + c; 

The technique of rewriting a query as a derived table also enables references to columns from GROUP BY queries. 

Because the results of INSERT ... SELECT  statements depend on the ordering of rows from the SELECT  and this order cannot always be guaranteed, it is possible when logging INSERT ... SELECT ON DUPLICATE KEY UPDATE  statements for the source and the replica to diverge. Thus, INSERT ... SELECT ON DUPLICATE KEY UPDATE  statements are flagged as unsafe for statement-based replication. Such statements produce a warning in the error log when using statement-based mode and are written to the binary log using the row-based format when using MIXED  mode. An INSERT ... ON DUPLICATE KEY UPDATE  statement against a table having more than one unique or primary key is also marked as unsafe. (Bug #11765650, Bug #58637) 

See also Section 17.2.1.1, “Advantages and Disadvantages of Statement-Based and Row-Based Replication” . 

## 13.2.6.3 INSERT DELAYED Statement 

INSERT DELAYED ... 

The DELAYED  option for the INSERT  statement is a MySQL extension to standard SQL. In previous versions of MySQL, it can be used for certain kinds of tables (such as MyISAM ), such that when a client uses INSERT DELAYED , it gets an okay from the server at once, and the row is queued to be inserted when the table is not in use by any other thread. 

DELAYED  inserts and replaces were deprecated in MySQL 5.6. In MySQL 8.0, DELAYED  is not supported. The server recognizes but ignores the DELAYED  keyword, handles the insert as a nondelayed insert, and generates an ER_WARN_LEGACY_SYNTAX_CONVERTED  warning: INSERT DELAYED is no longer supported. The statement was converted to INSERT . The DELAYED  keyword is scheduled for removal in a future release. 

## 13.2.7 LOAD DATA Statement 

LOAD DATA [LOW_PRIORITY | CONCURRENT] [LOCAL] INFILE ’ file_name ’ [REPLACE | IGNORE] INTO TABLE tbl_name [PARTITION ( partition_name  [, partition_name ] ...)] [CHARACTER SET charset_name ] [{FIELDS | COLUMNS} [TERMINATED BY ’ string ’] [[OPTIONALLY] ENCLOSED BY ’ char ’] [ESCAPED BY ’ char ’] ] [LINES [STARTING BY ’ string ’] [TERMINATED BY ’ string ’] ] [IGNORE number  {LINES | ROWS}] [( col_name_or_user_var [, col_name_or_user_var ] ...)] [SET col_name ={ expr  | DEFAULT} [, col_name ={ expr  | DEFAULT}] ...] 

