How to get mysql auto increment value
We sometimes need next auto increment value in a mysql table for various purposes. It can be achieved through querying INFORMATION_SCHEMA database.
Example:
Output:
Example:
SELECT `AUTO_INCREMENT` FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA = 'DatabaseName' AND TABLE_NAME = 'TableName';
Output:
AUTO_INCREMENT | |
---|---|
12 |
Comments (0)