Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8937715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:27:50+00:00 2026-06-15T10:27:50+00:00

I have a table in MySQL using InnoDB and a column is there with

  • 0

I have a table in MySQL using InnoDB and a column is there with the name “id”.

So my problem is that whenever I delete the last row from the table and then insert a new value, the new value gets inserted after the deleted id.

I mean suppose my id is 32, and I want to delete it and then if I insert a new row after delete, then the column id auto-increments to 33. So the serial format is broken ie,id =30,31,33 and no 32.

So please help me out to assign the id 32 instead of 33 when ever I insert after deleting the last column.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T10:27:50+00:00Added an answer on June 15, 2026 at 10:27 am

    Short answer: No.

    Why?

    1. It’s unnecessary work. It doesn’t matter, if there are gaps in the serial number.
    2. If you don’t want that, don’t use auto_increment.
    3. Don’t worry, you won’t run out of numbers if your column is of type int or even bigint, I promise.
    4. There are reasons why MySQL doesn’t automatically decrease the autoincrement value when you delete a row. Those reasons are
      • danger of broken data integrity (imagine multiple users perform deletes or inserts…doubled entries may occur or worse)
      • errors may occur when you use master slave replication or transactions
      • and so on …

    I highly recommend you don’t waste time on this! It’s really, really error prone.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a very large (10million+) row table stored in MySql using the InnoDB
I am using Mysql database. I have 3 table-: table Column tier_price customer_id,sku(Unique),price,website catalog_product
Using MySQL, I have a simple table that logs the IP Address that users
currently we using MySQL. We have table with spatial index (so no InnoDB) and
I have a table in MySQL 5 (InnoDB) that is used as a daemon
We're using MySQL and have an ~1.1 million record InnoDB table where the entire
We have a MySQL table with fields using latin1_swedish_ci however there is some UTF-8
I have one MySQL table using the InnoDB storage engine; it contains about 2M
What options do I have for importing a MySQL table using the InnoDB engine,
I am using mysql and have a table (Log_Table) storing user login dates, a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.