This post, originally posted in PHP code is more appropriate here.
Is there a way to delete a particular primary key in the middle of a table then re-sort them so that there are no gaps between numbers?
I'm not exactly sure when to use id INT. On what kind of data would one need such an index, and on what kind of data could one neglect its use?
Is it easier to delete rows (without making as many mistakes such as deleting the wrong row) with the use of this index?
id INT PRIMARY question
Moderator: General Moderators
-
jaymoore_299
- Forum Contributor
- Posts: 128
- Joined: Wed May 11, 2005 6:40 pm
- Contact:
You probably want to read up about database design (and normalization). There are some good hints in this forum too (Look at the sticky subjects..)
1-) Why don't you like gaps between the numbers? Have they a special meaning?
2-) You should use INT(EGER) when that is the most appropriate datatype for that column. So if the column is designated to store numbers, INT seems appropriate.
3-) Indices are used to speed up the finding of rows in a table. But there are books devoted to that subject, and you probably want to read the manual of your dbms too, because it may differ from dbms to dbms
4-) If your database design is done well, you will be able to identify each of your rows uniquely by using the primary key. This way, it's impossible to delete a different row.
1-) Why don't you like gaps between the numbers? Have they a special meaning?
2-) You should use INT(EGER) when that is the most appropriate datatype for that column. So if the column is designated to store numbers, INT seems appropriate.
3-) Indices are used to speed up the finding of rows in a table. But there are books devoted to that subject, and you probably want to read the manual of your dbms too, because it may differ from dbms to dbms
4-) If your database design is done well, you will be able to identify each of your rows uniquely by using the primary key. This way, it's impossible to delete a different row.