MySQL: Get next AUTO_INCREMENT value from/for table
Note to self: To get the nextauto_increment value from a table run this query:
SELECT AUTO_INCREMENT FROM information_schema.TABLES WHERE TABLE_SCHEMA = $dbName AND TABLE_NAME = $tblName. Don’t forget it (
again).
給自己做筆記:從表中獲取下一個自增值時只要運行以下sql語句即可:
AUTO_INCREMENT FROM information_schema.TABLES WHERE TABLE_SCHEMA = $dbName AND TABLE_NAME = $tblName;
例如:
SELECT auto_increment FROM information_schema.`TABLES` WHERE TABLE_SCHEMA='my_db_name' AND TABLE_NAME='my_table_name';
