Click to See Complete Forum and Search --> : Can I have a single-field table in a database??
ZF_NeAlvey
09-07-2007, 10:51 AM
Hi all. I'm working on a temporary database (Access 2003) for work until we get our system validated. Is it okay or acceptable to have a single-field table or do I need to throw an autonumber on there for the key? I really just need this table to populate a combobox/listbox in the form. I don't want to to use the "OnNotinList" with the combobox so I need to store them somewhere.
IE, I want a list of companies in a combobox pulling from tblCompanies. Can I just have "company" by itself (as the key) or do I need an autonumber "company_id" for the key?
Thanks!
MrDigital
09-07-2007, 12:47 PM
The key can be anything you want, but it has to be indexed and unique (no duplicates). One column is fine.
Strogian
09-07-2007, 10:44 PM
That's fine, but I have never personally found a single row table useful. At the least, I'd throw an integer ID field in there for internal representation of data.
OS-Wiz
09-08-2007, 12:07 AM
That's fine, but I have never personally found a single row table useful. At the least, I'd throw an integer ID field in there for internal representation of data. I agree with you on the single column table; never had a need for one and never seen one. Stick with natural Primary Keys until forced to use a surrogate; you'll be glad you did ;)
OS-Wiz
09-08-2007, 12:14 AM
Hi all. I'm working on a temporary database (Access 2003) for work until we get our system validated. Is it okay or acceptable to have a single-field table or do I need to throw an autonumber on there for the key? I really just need this table to populate a combobox/listbox in the form. I don't want to to use the "OnNotinList" with the combobox so I need to store them somewhere.
IE, I want a list of companies in a combobox pulling from tblCompanies. Can I just have "company" by itself (as the key) or do I need an autonumber "company_id" for the key?
Thanks! What you are describing is called a Look-up or Reference Data table, e.g. StateTwoLetterCode, or TypeCode.
StateTwoLetterCode
TwoLetterCode = MO
StateName = Missouri
TypeCode
Code = A
Description = After
Don't use autonumbers/surrogate keys until forced into it due to physical limitations of the database you are using, or for things/concepts that dont have a natural key like EmployeeID or InvoiceNumber.