Note to self: To get the next auto_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';


 

相关文章:

  • 2022-12-23
  • 2021-11-29
  • 2022-02-18
  • 2021-12-15
  • 2022-12-23
  • 2021-12-18
  • 2021-12-19
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-09-15
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案