r/DatabaseHelp • • Apr 28 '17

Need help with database structure

I have a restaurant that has 24 items on the menu. I need to create an orders table that keeps track of items in an order and then send the order to the kitchen. Do I create a table like this.

orders
    order_id    item1    item2    ...    item24
    -----------------------------------------------------
    1              1           0                 1

And keep a counter of item in each column? Or should I create another table for every single order and each row is an item with a quantity, like this

order1
    item_name    quantity
    ----------------------------------------------------
    item1            1
    item2            0
    item24          1

If it's the latter, there would hundreds or thousands of these tables, wouldn't it?

2 Upvotes

7 comments sorted by