Jump to content

Is it okay if this table only has one column/field


shanetastic

Recommended Posts

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.

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.