SpinTheMic
Pro

Interview practice question

Insert or update in one statement

Backend Engineering · Relational Databases · Intermediate

Your sync job receives records that may or may not already exist. How do you write them efficiently and safely?

What a strong answer covers

Your AI report card counts how many of these ideas you cover.

  • Upsert: INSERT ... ON CONFLICT DO UPDATE.
  • MySQL: ON DUPLICATE KEY UPDATE.
  • Needs unique key.
  • Atomic, avoids race.
  • Batch upserts.
Practise this topic

Start without signing up. Sign in free to get an AI report card on your answer.

See all topics