Both proposed alternatives to REPLACE INTO
and ON DUPLICATE KEY
are non-standard SQL from the MySQL variant. Thus, regardless of whether you use it, it depends: a) whether you use MySQl and b) whether you want to be attached to this option.
ANSI SQL defines MERGE
syntax, which is more standard if implemented on your platform
source share