In MySQL, the LAST_INSERT_ID()
function returns the first automatically generated value successfully inserted for an AUTO_INCREMENT
column as a result of the most recently executed INSERT
statement.
It can also be called with an argument, in which case, it returns the value of the expression and the next call to LAST_INSERT_ID()
will return the same value.