I recently wanted to check all tables’ current AUTO_INCREMENT value (if any) for a database dump structure. I wasn’t sure if a tables’ Data Definition Language (DDL) statement contained the current AUTO_INCREMENT value or not. So after I loaded the dump file, I learned of a query to use and find out…
The Newsletter for PHP and MySQL Developers
Receive a copy of my ebook, “10 MySQL Tips For Everyone”, absolutely free when you subscribe to the OpenLampTech newsletter.

The INFORMATION_SCHEMA Database
We can use the valuable INFORMATION_SCHEMA database and query the TABLES table for any AUTO_INCREMENT column value.
Below is an example query, in which I target the well-known practice Sakila database:
SELECT TABLE_NAME, AUTO_INCREMENT
FROM TABLES
WHERE TABLE_SCHEMA = 'sakila';
📰 Get your brand, product, or service the attention it deserves with affordable classified ad placement in the OpenLampTech newsletter. I appreciate your support!
I hope you found this article valuable. You may never need (or care) to know a table’s AUTO_INCREMENT value. However, if you do, you can refer to this article. I know I will. 🙂
Recommended Reading
- MySQL’s AUTO_INCREMENT attribute
- PHP PDO lastInsertId() method with examples in MySQL
- How to Retrieve MySQL Last Insert ID in CodeIgniter 4
Refer other subscribers to the OpenLampTech newsletter and receive rewards and perks.
Thank you for reading this post. Please share it with someone else who would enjoy it as well.
Josh Otwell has a passion to grow as a PHP Developer, SQL expert, and technical blogger/writer.
Disclaimer: The majority of examples in this post, are performed in a personal development/learning workstation environment and should not be considered production quality or ready. Your particular goals and needs may vary. Like always, just because you can do something doesn’t mean you should. My opinions are my own.
More ways I can help
- Need hosting for your next web application or WordPress site? I highly recommend Hostinger and use them to host my niche bass fishing site. The service is second to none.
- 🔒5 Truths I’ve Come To Realize As a Self-taught Developer
- Desktop and mobile wallpapers, digital downloads, photography services, Shopify and WooCommerce customizations, and content writing – all in one E-commerce Shop. Find your next digital purchase today!
- Take your Laravel applications next level with Battle Ready Laravel by Ash Allen. Learn how to improve the performance, maintainability, and security of your Laravel projects in this e-book.
Disclosure: Some of this blog post’s services and product links are affiliate links. At no additional cost to you, should you make a purchase by clicking through one of them, I will receive a commission.
The Newsletter for PHP and MySQL Developers
Receive a copy of my ebook, “10 MySQL Tips For Everyone”, absolutely free when you subscribe to the OpenLampTech newsletter.
📰 Get your brand, product, or service the attention it deserves with affordable classified ad placement in the OpenLampTech newsletter. I appreciate your support!