Replace Update or Insert a row Into Sqlite Table

by

In Mysql, if you want to either updates or inserts a row in a table, depending if the table already has a row that matches the data, you can use “ON DUPLICATE KEY UPDATE”.

How to do it in Sqlite?

Use “INSERT OR REPLACE INTO” .

For example:

INSERT OR REPLACE INTO Employee (id, name, role) 
VALUES (1, 'John Foo', 'CEO');

You can see this page for more information: http://stackoverflow.com/questions/418898/sqlite-upsert-not-insert-or-replace

In SQL Server, http://www.withdata.com/ad/sql-server/replace-update-or-insert-a-row-into-sql-server-table.html

In Oracle, http://www.withdata.com/ad/oracle/replace-update-or-insert-a-row-into-oracle-table-merge-into.html

In DB2, http://www.withdata.com/ad/db2/replace-update-or-insert-a-row-into-db2-table-merge-into.html

In PostgreSQL, http://www.withdata.com/ad/postgresql/replace-update-or-insert-a-row-into-postgresql-table.html

Some SQLite tools you can try: https://www.withdata.com/sqlite/

One thought on “Replace Update or Insert a row Into Sqlite Table

  1. Pingback: Replace Update or Insert a row Into PostgreSQL Table | Withdata Software