That's not really true. You can use an auto_increment field as the primary key and create a seperate UNIQUE index that combines both the firstname and lastname fields that will be inforced for inserts. Usually its easier to work with integers as primary keys, especially when you reference them in other tables and such. I assume its slightly faster for MySQL to work with shorter integers than longer strings as primary keys but I could be wrong.
Chris -----Original Message----- From: Christian Stromberger [mailto:[EMAIL PROTECTED]] Sent: Thursday, November 08, 2001 5:59 PM To: Mysql Subject: String composite key vs auto_increment Disclaimer: SQL/database newbie here. Let's say I have a table of authors with columns for last name and first name. Is there any general guideline re using a separate integer for the primary key as opposed to a combination of the last and first names as the key? I ask because by using the names, this would prevent duplicate entries into the db, right? Whereas using a separate integer key would not prevent this--you'd have to search for the author to see if it was already in the db before inserting to avoid dupes, right? Assume I am not concerned about there being two different "Joe Smith" authors that are different people. I only want to associate an author name with a book. (Any pointers to good resources besides advice from this list also appreciated) Many thanks. -Chris --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php