First, we inserted 3 records into the tbl table by using a single INSERT statement. Then, we used the LAST_INSERT_ID function to get the last insert id, which is the id of the 'record 1' .
The LAST_INSERT_ID function works based on client-independent principle. It means the value returned by the LAST_INSERT_ID function for a specific client is the value generated by that client only. This ensures that each client can obtain its own unique ID.
In this tutorial, we have shown you how to use the MySQL LAST_INSERT_ID function to get the sequence number of the last record that has been inserted into a table.