MySQL使用SQL语句查询指定表的自增主键的下一个值

版权声明:学习 https://blog.csdn.net/qq_40238006/article/details/86626499

直接上代码:

SELECT
	auto_increment
FROM
	information_schema.`TABLES`
WHERE
	table_name = '表名称'
AND TABLE_SCHEMA = '库名称'

另外有兴趣的同学可以研究下information_schema这个数据库下的表,会发现一些很有意思的东西

猜你喜欢

转载自blog.csdn.net/qq_40238006/article/details/86626499