We sometimes need next auto increment value in a mysql table for various purposes. It can be achieved through querying INFORMATION_SCHEMA database.

Example:

SELECT `AUTO_INCREMENT` FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA = 'DatabaseName' AND TABLE_NAME = 'TableName';

Output:
 
AUTO_INCREMENT  
12

 


Comments (0)
Leave a Comment

loader Posting your comment...