atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Sat Apr 02, 2011 9:13 am Post subject: |
|
|
Simply put; don't. Your ID field is being used as a primary key making it 'unique' to whoever owned it. Meaning after it has been used one, it cannot be used again.
Think of it like this, lets say we have your first table:
Code: | ID NAME ADDRESS
1 John Saint Marie st.
2 Julie Baha st.
3 Adam Heir st.
4 Joe Saint Cleveland st. |
And lets say this is a shopping cart site or something where people can buy things. Lets say Adam has ordered 4 things online but for some reason you feel the need to delete his account before his order finishes. Now you have:
Code: | ID NAME ADDRESS
1 John Saint Marie st.
2 Julie Baha st.
3 Joe Saint Cleveland st. |
Which at this point now Joe has Adam's shipment information, order information, and access to any and all of Adams old orders, data, and personal information.
The point of primary keys is for security as well as unique ids. Don't use the ID if you need any specific data other then a unique identifier. If you want a count of the users just use COUNT(*) in your queries instead.
_________________
- Retired. |
|