Updated on 2022-08-17 GMT+08:00

INSERT

INSERT is used to insert data into database objects.

Common Syntax

INSERT [INTO] tbl_name
[(col_name,...)]
{VALUES | VALUE} ({expr },...),(...),...
[ ON DUPLICATE KEY UPDATE
col_name=expr
[, col_name=expr] ... ]
OR
INSERT [INTO] tbl_name
SET col_name={expr | DEFAULT}, ...
[ ON DUPLICATE KEY UPDATE
col_name=expr [, col_name=expr] ... ]

Syntax Restrictions

  • INSERT DELAYED... is not supported.
  • Only INSERT statements that contain sharding fields are supported.
  • PARTITION syntax is not supported. Partitioned tables are not recommended.