REPLACE

You can execute REPLACE statements to insert rows to tables or replace rows in tables.

Syntax

REPLACE [LOW_PRIORITY | DELAYED]
[INTO] [schema_name.]tbl_name
[(col_name [, col_name] ...)]
{VALUES | VALUE} (value_list) [, (value_list)]

REPLACE [LOW_PRIORITY | DELAYED]
[INTO] [schema_name.]tbl_name
SET assignment_list

REPLACE [LOW_PRIORITY | DELAYED]
[INTO] [schema_name.]tbl_name
[(col_name [, col_name] ...)]
SELECT ...

value_list:
value [, value] ...

value:
{expr | DEFAULT}

assignment_list:
assignment [, assignment] ...

assignment:
col_name = value

Limits on syntax

The following REPLACE statements are not supported:

  • REPLACE statements that contain PARTITION functions

    REPLACE INTO tb PARTITION (p0) (id) VALUES(7);
    
  • REPLACE statements that contain column names

    REPLACE INTO tb(id1, id2) VALUES(1, id1 + 1);
    

References

REPLACE statements for the native MySQL

results matching ""

    No results matching ""