shanetastic Posted September 21, 2011 Share Posted September 21, 2011 I need to create a table containing only a list of company names. Company names should not be null and should be unique. Can I just have one column (the company name) and make it the primary key? Or do I need to have two columns, an auto-incrementing int as the primary key and the company name? If it is better to have the int PK, please explain why. Quote Link to comment https://forums.phpfreaks.com/topic/247603-is-it-okay-if-this-table-only-has-one-columnfield/ Share on other sites More sharing options...
requinix Posted September 21, 2011 Share Posted September 21, 2011 If you're going to use the companies anywhere else in the database (ie, with foreign keys) then you need an ID. Besides the storage implications, it properly separates identifier from data identified: you can change names all you want without breaking relationships. Quote Link to comment https://forums.phpfreaks.com/topic/247603-is-it-okay-if-this-table-only-has-one-columnfield/#findComment-1271488 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.