Home  >  Q&A  >  body text

postgresql - What are the advantages and disadvantages of on duplicatekey update in MYSQL?

on duplicatekey update

Update if it exists, insert if it does not exist. Operations we commonly use in business.

However, he is rarely seen in projects. What is the reason for this?
Most of them are used for business purposes.
1.select
2.insert or update
Some databases support using save instead (insert && update).

PHP中文网PHP中文网2674 days ago1348

reply all(1)I'll reply

  • PHP中文网

    PHP中文网2017-06-24 09:43:38

    I understand that in most business scenarios, insert and update are different functions, and the corresponding SQL statement is clearly INSERT or UPDATE

    When doing some complex statistical functions, the on duplicatekey update function will be used, which is the merge statement in Oracle.

    reply
    0
  • Cancelreply