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!

Like our articles?
Check out our Laravel online courses!

LEAVE A REPLY

Please enter your comment!
Please enter your name here