Retrieve MAX Primary Key values of all tables in a database at once
If (and only if) your primary keys are AUTO INCREMENT
variables you can do this:
SELECT TABLE_NAME, AUTO_INCREMENT
FROM information_schema.TABLES
WHERE TABLE_SCHEMA = 'mydb'
If (and only if) your primary keys are AUTO INCREMENT
variables you can do this:
SELECT TABLE_NAME, AUTO_INCREMENT
FROM information_schema.TABLES
WHERE TABLE_SCHEMA = 'mydb'