Insert into a MySQL table or update if exists
Use INSERT … ON DUPLICATE KEY UPDATE QUERY:
Use INSERT … ON DUPLICATE KEY UPDATE QUERY:
9.5 and newer: PostgreSQL 9.5 and newer support INSERT … ON CONFLICT (key) DO UPDATE (and ON CONFLICT (key) DO NOTHING), i.e. upsert. Comparison with ON DUPLICATE KEY UPDATE. Quick explanation. For usage see the manual – specifically the conflict_action clause in the syntax diagram, and the explanatory text. Unlike the solutions for 9.4 and older that are given below, this feature works with … Read more