Top "Insert-update" questions

A mixed flavour of data entry mode and data modification mode.

Insert into a MySQL table or update if exists

I want to add a row to a database table, but if a row exists with the same unique key …

mysql sql insert-update upsert
SQL Server insert if not exists best practice

I have a Competitions results table which holds team member's names and their ranking on one hand. On the other …

sql-server insert-update
How to UPSERT (MERGE, INSERT ... ON DUPLICATE UPDATE) in PostgreSQL?

A very frequently asked question here is how to do an upsert, which is what MySQL calls INSERT ... ON DUPLICATE …

postgresql insert-update upsert sql-merge
Update a column in MySQL

I have a table table1 with three columns and a bunch of rows: [key_col|col_a|col_b] I …

mysql insert-update
INSERT INTO ... SELECT FROM ... ON DUPLICATE KEY UPDATE

I'm doing an insert query where most of many columns would need to be updated to the new values if …

mysql insert-update
How do you determine if an insert or update was successful using Java and MySQL?

I am using Java to connect to a MySQL database. I am trying to insert or update data into the …

java mysql jdbc insert-update
MySQL trigger On Insert/Update events

So I have two tables like this... ext_words ------------- | id | word | ------------- | 1 | this | ------------- | 2 | that | ------------- | 3 | this | ------------- ext_…

mysql triggers insert insert-update
How do I update if exists, insert if not (AKA "upsert" or "merge") in MySQL?

Is there an easy way to INSERT a row when it does not exist, or to UPDATE if it exists, …

sql mysql insert-update upsert
Does DB2 have an "insert or update" statement?

From my code (Java) I want to ensure that a row exists in the database (DB2) after my code is …

sql database db2 insert-update upsert
How to INSERT a record or UPDATE if it already exists?

I have a table with columns record_id (auto inc), sender, sent_time and status. In case there isn't any …

mysql insert insert-update