thindrakhya Posted July 28, 2007 Share Posted July 28, 2007 hi friends i want to fill the gaps in the table column for the rows which are deleted like i have id 1 2,3,4,5 if i delete id = 3 and insert next record then with auto_increment the next record will be added with ID 6 not at 3 Will it be better that when i delete any rows i will store that ids in different table column and when i need to insert any data the i will select the min(ID) from thta column name and if there is no ID in that colum then i will use select MAX(id) from the current table Is this solution viable Quote Link to comment Share on other sites More sharing options...
trq Posted July 28, 2007 Share Posted July 28, 2007 The question needs to be asked. Why would you want to do this? If you are relying on your ids always being in sequence you are doing something wrong. databases are designed to be unordered collections of data. Quote Link to comment Share on other sites More sharing options...
Fadion Posted July 28, 2007 Share Posted July 28, 2007 Yep theres really no question there. Why store deleted ids in a different table?! It would be just a pointless table with pointless ids. Quote Link to comment Share on other sites More sharing options...
thindrakhya Posted July 28, 2007 Author Share Posted July 28, 2007 thanks for you help I was just think thats it looks good , i don't have any particular eason for doing this If u think there is no problem with un ordered list then that is better I want to ask one thing if you can guide In the PHPforums database desgin when all the registered users posts new topic or send reply then do all the posts from the all users store in same table with fields something like post_id , sender-name , ............. or the posts from different users are stored in differnt tables I want to know because this way post_id coulmn will be very very bigger Quote Link to comment Share on other sites More sharing options...
trq Posted July 28, 2007 Share Posted July 28, 2007 In the PHPforums database desgin when all the registered users posts new topic or send reply then do all the posts from the all users store in same table with fields something like post_id , sender-name , ............. or the posts from different users are stored in differnt tables Storing each users posts in a seperate table would be rediculous. Take a look at database normalisation techniques, this should help you out with database design. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.