I have a question on the proper design of tables. Let's say I have a table called Hamburger and this hamburger can have many condiments on it such as cheese, ketchup, etc.. I want to hold this information in a set of tables. Each condiment must be in its own table because there are different columns for each condiment.
Here is what I have:
hamburger - (ham_id, title, etc..)
ham_condiments (ham_id, condiment_id, parent_condiment_id,condiment_type)
cheese (cheese_id, name, cheese specific columns)
meat (meat_id, name, some beef specific columns)
mayo (mayo_id, name, some mayo specific columns)
So, the ham_condiments is sort of showing the one to many from the hamburger table and the mayo_id, meat_id and cheese_id are used in the condiment_id column in the ham_condiments table.
The reason for all of this is the parent_condiment_id which will show the correct order of the condiments in the hamburger.
So, if you wanted to see all of the condiments on a hamburger, you would:
select ham.title, c.name, m.name, mo.name, condiment_type
hamburger ham,
ham_condiments hc,
cheese c,
meat m,
mayo mo
where
ham.ham_id = hc.ham_id and
hc.condiment_id = c.cheese_id and
hc.condiment_id = m.meat_id and
hc.condiment_id = mo.mayo_id
order by hc.parent_condiment_id
(parent_condiment_id could just be a sort_order column with values starting at 1,2,3,4 as well)
Am I just over thinking this here? I'm basically adding another table ust to hold the order of the condiments inside the hamburger but am having a hard time putting it together. Thanks for any help.