SpinTheMic
Pro

Interview practice question

Half-saved data after an error

Backend Engineering · Relational Databases · Beginner

Creating an order inserts into orders and order_items. Sometimes an error leaves an order with no items. How do you fix it?

What a strong answer covers

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

  • Wrap both inserts in a transaction.
  • Rollback on any error.
  • Framework transaction management.
  • Constraints/checks.
  • Clean up existing bad data.
Practise this topic

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

See all topics