Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Jul 2006
    Location
    Cincinnati, OH
    Posts
    85
    Thanks
    1
    Thanked 0 Times in 0 Posts

    What exactly is a lookup table?

    I was told to use a lookup table for the current situation. A couple signs up together for an online course, which is one of the radio button options (i.e. Individual, Couple).

    I am assuming that it means to have a table called couples or something similar and when I create the accounts for the two they are added to the normal students table as well as the couple table. That way I can run a query on the couple table when I need to find out if a person signed up for a course as an individual or as part of a couple.

    Is this the basic idea of a lookup table? I tried some google searches but it really didnt give me any great information on it.

    Thanks!

  • #2
    Super Moderator guelphdad's Avatar
    Join Date
    Mar 2006
    Location
    St. Catharines, Ontario Canada
    Posts
    2,633
    Thanks
    4
    Thanked 148 Times in 139 Posts
    merchanise table:
    id name
    1 carrots
    2 bread
    3 milk

    stores table:
    1 Zehrs
    2 Loblaws
    3 No Frills

    lookup table store_merchandise:
    1, 1
    1, 3
    3, 1
    3,2
    3,3

    allows you to look up the items each store has in stock.

  • #3
    Senior Coder
    Join Date
    Jul 2005
    Location
    New York, NY
    Posts
    1,084
    Thanks
    4
    Thanked 19 Times in 19 Posts
    Quote Originally Posted by guelphdad
    merchanise table:
    id name
    1 carrots
    2 bread
    3 milk

    stores table:
    1 Zehrs
    2 Loblaws
    3 No Frills

    lookup table store_merchandise:
    1, 1
    1, 3
    3, 1
    3,2
    3,3

    allows you to look up the items each store has in stock.
    Actually, I have a different understanding. In the above example, I would call "store_merchandise" a "relational table" because it represents the relationships bewteen different objects. I would call both "merchandise" and "stores" lookup tables in their current form.

    However, let's say the "stores" table looked like this:

    id
    name
    address1
    address2
    address3
    city
    state
    zipcode
    status

    and we had a "status" table:
    id, label
    1, Open
    2, Closed
    3, Condemned
    4, Renovating
    5, On Fire

    and the values in the "stores" table in the column "status" were constrained by a foreign key to be only values in the "id" column of the "status" table, then I would call the "status" table a lookup table, as you're looking something up. Without the look up table, your application functions in exactly the same way, except you can't "lookup" the text labels that make the data more user friendly.

    This is my understanding, and I may completely wrong, and I urge others to help shed light on the issue.

  • #4
    Super Moderator guelphdad's Avatar
    Join Date
    Mar 2006
    Location
    St. Catharines, Ontario Canada
    Posts
    2,633
    Thanks
    4
    Thanked 148 Times in 139 Posts
    now that I rethink it yes Beagle's example would be a lookup table.


  •  

    Posting Permissions

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