MySQL Auto-Increment: What Happens If Insert Fails?

Pretty random question, almost like a trivia/pubquiz thing. Let's say I'm doing insert SQL query, and if it fails - for example, some foreign or unique key is violated. What would be the ID of the next successful inserted record? Will it increase?

Let's find out in this short video experiment.

For more videos like this (though this one is pretty untypical for me), subscribe to our YouTube channel!

No comments or questions yet...

Like our articles?

Become a Premium Member for $129/year or $29/month
What else you will get:
  • 59 courses (1056 lessons, total 42 h 44 min)
  • 78 long-form tutorials (one new every week)
  • access to project repositories
  • access to private Discord

Recent Premium Tutorials