Webmaster Forum

Go Back   Webmaster Forum > Web Development > Web Design Lobby

Web Design Lobby Forum for general web design issues not specific to scripting or graphics.


Reply
 
Thread Tools Display Modes
Share |
  #1  
Old 12-14-2008, 03:40 PM
2939195631902 2939195631902 is offline
Contributing Member
 
Join Date: 12-14-08
Posts: 140
iTrader: 0 / 0%
Unhappy auto_increment unable to recognize deleted rows in MYSQL

I've been messing with mysql for the past 3 hours and came to realize that the auto_increment is unable to recognize deleted rows.

What i mean is when i delete a row with id of 4, and then add another row, the auto_increment will give the new row a id of 5 instead of 4.

The end result will be 4 rows with ids: 1, 2, 3, 5 instead 1, 2, 3, 4.

Is there a way to fix this?

If not, is there a benefit to the auto_increment increments.
 
Reply With Quote

Advertisement

Advertisement

  #2  
Old 12-14-2008, 05:06 PM
leonid leonid is offline
Contributing Member
 
Join Date: 11-17-08
Location: NJ
Posts: 55
iTrader: 0 / 0%
The purpose of the auto-increment is to give a unique id to the row,
and NOT to innumerate the rows (put them in order 1..n).

You don't fix something that doesn't need to be fixed.

What problem are you trying to solve?
 
Reply With Quote
  #3  
Old 12-15-2008, 12:00 PM
kos's Avatar
kos kos is offline
Coding Tiger
 
Join Date: 04-13-07
Location: .ro
Posts: 4,029
iTrader: 3 / 100%
good answer.
 
Reply With Quote
  #4  
Old 12-20-2008, 04:01 PM
panizon panizon is offline
Junior Member
 
Join Date: 07-19-07
Posts: 16
iTrader: 0 / 0%
If you do want to maintain such numbering (for whatever the reason is) add in another int column to the table, and manage the values yourself.
 
Reply With Quote
Go Back   Webmaster Forum > Web Development > Web Design Lobby

Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to retrieve the total number of rows when using LIMIT X, XXX yangyang Coding Forum 3 09-21-2008 06:27 PM
MySQL Auto_increment Capo64 Coding Forum 5 12-17-2007 04:15 PM
Does Google recognize js links? GemFashion Google Forum 4 01-29-2006 01:09 PM
Recognize this? South Graphic Design Forum 9 11-11-2003 05:41 PM


V7N Network
Get exposure! V7N I Love Photography V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 12:44 PM.
Powered by vBulletin
Copyright 2000-2014 Jelsoft Enterprises Limited.
Copyright © 2003 - 2018 VIX-WomensForum LLC