The INSERT OR REPLACE Statement

You can use the INSERT OR REPLACE statement to write new rows or replace existing rows in the table. The syntax and behavior of the INSERT OR REPLACE statement is similar to the INSERT statement. Unlike the INSERT statement, the INSERT OR REPLACE statement does not generate an error if a row already exists.

For information about the INSERT statement, see The SQL INSERT Statement.

Syntax

INSERT OR REPLACE INTO <table_name> [(<column_name_list>)] VALUES (<column_value_list>)[,(<column_value_list>)]...
where
  • table_name: Name of the table in which the rows are inserted.
  • column_name_list: Each column name in column_name_list identifies a column of table_name.
  • column_value_list: Values for the columns in column_name_list.
Related concepts