MySQL: Script to find Last AUTO_INCREMENT value for a Table

In this post, I am sharing script to find last updated AUTO_INCREMENT of a MySQL Table.

Generally, we use LAST_INSERT_ID() function to get last updated AUTO_INCREMENT value for particular running session. This function basically we use with any procedure block and it will return last updated AUTO_INCREMENT value of the last executed statement.

At the other side, Database Administrator also require to find last updated AUTO_INCREMENT value for any table and wants to generate report for that.

Below is a script to find last updated AUTO_INCREMENT value:

Using INFORMATION_SCHEMA.TABLES:

Using STATUS command:

Please visit other related Article !
MySQL: Get ID of the Last Updated Row

Anvesh Patel

Leave a Reply

Be the First to Comment!

Notify of
avatar
wpDiscuz