Is it necessary? No, not really, and does impose a minor performance hit.
I generally use auto-incremented primary keys on tables where there are definite parent-child relationships. These keys can be used in the background avoiding any future complications where a client decides to redefine the serial number or similar value often used as primary key. Thus you are pretty-well protected against changes to data fields, whihc means logic isn't broken, etc.
For lookup tables and the like I don't bother with auto-incremented keys.
Regards, and I hope this helps - Miles Thompson
At 11:38 PM 5/9/2003 +0100, shaun wrote:
Hi,
I seem to be putting an auto increment id field in all my tables, is this a bad thing? If so when should and shouldn't they be used?
Thanks for your help
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php