PDA

View Full Version : Primary Key Order


weronpc
04-14-2003, 10:29 PM
I have a primary key called ID, ID is set to AUTO_INCREMENT.

the table contains total of 5 records and the order of the records is 1, 2, 3, 4, 5.

I delete record number 3, the id order goes like this, 1, 2, 4, 5.

Is there a way to make the order goes 1, 2, 3, 4 instead of 1, 2, 4, 5?

Thank you,

Mike

raf
04-14-2003, 10:41 PM
To me, the question is more like: is there any need to do so? ;)
If you really want that, drop the autoincrement column and insert a new one. But i definately would not recommend that !!

If you have a relational table that uses this variable for a join, then this surely would create problems.

When i started working with db's, is thought kinda spreadsheet like. I openend tables and read them and it had to make sense to me. But that's not the way to handle db's.

Also, probably a good idea to choos another name then ID. When you're using multiple tables, it can get confusing.