...

View Full Version : What exactly is a lookup table?



justincredible
08-25-2006, 07:13 PM
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!

guelphdad
08-25-2006, 08:57 PM
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.

Beagle
08-28-2006, 03:52 PM
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.

guelphdad
08-28-2006, 06:31 PM
now that I rethink it yes Beagle's example would be a lookup table.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum