LAST_INSERT_ID
Returns the last value of an AUTO_INCREMENT/IDENTITY column.
Returns the last value of an AUTO_INCREMENT
/IDENTITY
column. If multiple sessions concurrently load the same table with an AUTO_INCREMENT
/IDENTITY
column, the function returns the last value generated for that column.
Note
This function works only withAUTO_INCREMENT
/IDENTITY
columns. It does not work with named sequences.
This is a meta-function. You must call meta-functions in a top-level SELECT statement.
Behavior type
VolatileSyntax
LAST_INSERT_ID()
Privileges
-
Table owner
-
USAGE privileges on the table schema