In PostgreSQL, I have to use upsert
. It checks if the line already exists, if it does, it does update, otherwise it does insert.
In MySQL I am not able to do this, I saw some talking to use INSERT ... ON DUPLICATE KEY UPDATE
, however all the examples I saw were reporting id.
But I do not have the ID, the ID of my table is automatically generated for every insert I make, so I do not give this ID when making an insert.