Search Results: Found 2
MySQL Masterclass: How to Set a Custom Starting Value for AUTO_INCREMENT IDs
2026-01-03 DP

By default, MySQL auto-incrementing IDs start at 1. However, sometimes we need to reserve a specific range for IDs, for instance, starting from 101. This article provides a deep dive into setting a custom starting value for an `AUTO_INCREMENT` column, both when creating a new table (using DDL) and modifying an existing one (using ALTER TABLE). We offer clear code examples and, from the perspective of architect DP, analyze common scenarios and best practices for reserving IDs to help you build more robust and scalable database models.

MySQL Primary Key Inversion: Swap 1 to 110 with Just Two Lines of SQL
2025-12-03 DP

In database management, you might face the unique challenge of inverting primary key values in a MySQL table, such as reversing IDs from 1-110 to 110-1. Direct updates will cause primary key conflicts. This article from the wiki.lib00.com team (DP@lib00) delves into three efficient solutions: the offset method, the temporary column method, and the negative number method. We provide detailed code examples and a performance comparison to help you choose the fastest and safest approach.