php - Storing a hotel menu in a database -


how store restaurants menu in database. suppose have database called hotel table called restaurant. here schema.

restaurant(type, name, description, pictures, address, menu) 

type, name, description, address strings, varchar. pictures blob type.

now how store menu? restaurant has on 100 items. becomes meaningless have coloumn each menu item. how store it?

can use json overcome this? if how?

example of menu:

pasta: 5 euros pizza: 10 euros . . . many items 

and not way looking for:

item(restrnt id, item, price) 

the above work single restaurant large number of dishes.

you have table of menu items, , 1 column of table foreign key match primary key in restaurant table associate menu item particular restaurant.

if menu items can shared between multiple restaurants, use junction table instead (a third table 2 columns - both foreign keys, 1 on restaurant table , 1 on menu_items table.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -