Withdata Software

Upsert a row Into Mysql Table

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”.

INSERT INTO employees(id, name, hire_date ) 
VALUES (1, 'John', '2016-11-29' ) 
ON DUPLICATE KEY UPDATE name='john', hire_date='2016-11-29'

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

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

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

In Sqlite, https://www.withdata.com/blog/sqlite/replace-update-or-insert-a-row-into-sqlite-table.html

Some MySQL tools you can try: https://www.withdata.com/mysql/

Convert your data online, free

Free in-browser converters for CSV, Excel, JSON, XML and SQL: Withdata Online Data Conversion. Large files, batch conversion or scheduling? See the offline desktop apps, or browse all data conversion tools.