MySQL question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • biskoppen
    Confirmed User
    • Mar 2003
    • 5809

    #1

    MySQL question

    Let's say I have a table with an auto_increment field called "id"..

    This table got 5 rows.. where "id" goes from 1-5..

    Now I delete row 4 and 5..

    The next row I insert will get "id" = 6...

    How do I get it do let the next "id" to start at 4 which is the highest available number?

    (Don't ask why I need that )
    Submit my videos to make bank, tons of 5 minute videos offered right here
  • budz
    Disruptive Innovator
    • Sep 2003
    • 4230

    #2
    I use navicat.. you can edit anything in your table manually.

    but I'd like to know how to automate this because that is annoying when you delete records
    C:\Code\
    C:\Code\Run\

    Comment

    • Donkey Punch
      Confirmed User
      • Jun 2007
      • 1260

      #3
      INNODB tables store the auto increment id in the MYI file. Even if you delete rows and restart the server MySQL will not reuse the id. The same is true for innodb.
      from gooooogle serps
      ICQ:407-837-607
      Hosting a Problem? Phat Servers = Answer

      Comment

      • k0nr4d
        Confirmed User
        • Aug 2006
        • 9231

        #4
        i think 'OPTIMIZE' does that. google it, im not positive
        Mechanical Bunny Media
        Mechbunny Tube Script | Mechbunny Webcam Aggregator Script | Custom Web Development

        Comment

        • biskoppen
          Confirmed User
          • Mar 2003
          • 5809

          #5
          Originally posted by k0nr4d
          i think 'OPTIMIZE' does that. google it, im not positive
          Hmm... actually think I heard about that some years ago... will investigate that
          Submit my videos to make bank, tons of 5 minute videos offered right here

          Comment

          • Alky
            Confirmed User
            • Apr 2002
            • 5651

            #6
            why even use the auto increment feature then? just use your own id #'s

            Comment

            • biskoppen
              Confirmed User
              • Mar 2003
              • 5809

              #7
              Originally posted by Alky
              why even use the auto increment feature then? just use your own id #'s
              Yeah, that was mine conclusion too... changing it right now.. (Thanks though)
              Submit my videos to make bank, tons of 5 minute videos offered right here

              Comment

              Working...