Looking for some advice on how I might accomplish this MySQL task: I want to have a table with a list of orders (Table 1), but each order needs to have a list of a bunch of food items. So would I reference a different table in each row of Table 1 that holds these food items?
Table 1 –
customer: | reference to table | time placed | customer name|
etc…..
Here’s what your schema should look like:
orders: id | table_id | time | customer_name
items: id | name
order_items: id | order_id | item_id
An order can have multiple food items and one food item can belong to multiple orders. Typical case of many-many mapping.