Can I have a single-field table in a database??

Sharky Forums


Results 1 to 5 of 5

Thread: Can I have a single-field table in a database??

  1. #1
    Reef Shark
    Join Date
    Aug 2001
    Location
    Northern Kentucky
    Posts
    337

    Can I have a single-field table in a database??

    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!

  2. #2
    Snarky Quorums MrDigital's Avatar
    Join Date
    Mar 2004
    Location
    Canuckistan
    Posts
    8,224
    The key can be anything you want, but it has to be indexed and unique (no duplicates). One column is fine.
    There is the theory of the moebius. A twist in the fabric of space where time becomes a loop.

  3. #3
    Hammerhead Shark
    Join Date
    Feb 2001
    Posts
    1,612
    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.

  4. #4
    Old School OCer OS-Wiz's Avatar
    Join Date
    Dec 2001
    Location
    St. Louis, Mo, USA
    Posts
    12,242
    Quote Originally Posted by Strogian
    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
    The Money Trap = Intel i7 930 | Corsair H70 | ASUS P6X58D-E | 3 x 2GB G.Skill DDR3 2000 6-9-6-24 | EVGA GTX 580 DS SC | OCZ Vertex 2 90GB SSD | WD VelociRaptor | Klipsch ProMedia | Cooler Master HAF 932 | Antec TPQ-1200W | Dell U2711 2560 x 1440 27" | Windows 7 Ultimate 64-bit | APC RS1500

  5. #5
    Old School OCer OS-Wiz's Avatar
    Join Date
    Dec 2001
    Location
    St. Louis, Mo, USA
    Posts
    12,242
    Quote Originally Posted by ZF_NeAlvey
    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.
    The Money Trap = Intel i7 930 | Corsair H70 | ASUS P6X58D-E | 3 x 2GB G.Skill DDR3 2000 6-9-6-24 | EVGA GTX 580 DS SC | OCZ Vertex 2 90GB SSD | WD VelociRaptor | Klipsch ProMedia | Cooler Master HAF 932 | Antec TPQ-1200W | Dell U2711 2560 x 1440 27" | Windows 7 Ultimate 64-bit | APC RS1500

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •