Lookup Table question

Hi,

I’m in the middle of the Sitepoint book “Build your own database driven web site using PHP & MySQL” and on page 168 it says “Now that your lookup table is in place and contains category assignments, you can use joins…”.

Am I correct in assuming that this lookup table (titled “jokecategory” in the book) was populated with the category assignments manually? - That each value was assigned to it’s field through an INSERT INTO command?

Or am I missing something and there was some way that the lookup table was automatically populated with the data from the other two tables (“joke” and “category” in the book)?

Thanks very much!

Michael

Your assumption is quite logical.

I don’t have the book itself in front of me right now but if it is a lookup table, either you fill it using INSERT INTO commands, or you import the data from a CSV file or other type of text file. Either way, at some point, you had to insert the data manually.

Other solution could be to extract these values from some other table using a SELECT query with a DISTINCT attribute so you will not get repeated values in the result. That is, of course, if the values where already in other table :wink: