mysql - How to create a Database for listing Buffet system of Restaurants? -


The restaurant has buffets and spreads to the buffets separately. I want to enable photos and comments on each dish on the buffet

I have a restaurant db that stores the general information of the rest. The dishes DB stores the restaurant's dish. Each dish is again mapped to a category such as beginning, drink, main course.

How to store dishes as a part of the restaurant's buffet in a normalized way now

You need a special buffet key with a primary key (REST_ID, BUFFET_ID) and other restaurant attributes (such as name and location, name of the chef)

For example the name (other buffet features like "salad bar," "Smorgasbord," or "sweet")

A dish table is required with (name, "potato salad", "bentant nan") (REST_ID, BUFFET_ID, DISH_ID) and other features like

you need it Primary name (REST_ID, BUFFET_ID, DISH_ID , PHOTO_ID) and a photo table with other features, for example, the path name or blob for your photo, and captions.

Give you a review table primary key (REST_ID, BUFFET_ID, DISH_ID, REVIEW_ID).

Note that this data model has a design choice: it is not possible to look at two different buffet for the same dish, it is not possible to display the buffet in two different restaurants. , The data is strictly hierarchized:

  A restaurant: zero, one or more buffets a buffet: zero, one or more dishes consisting of one: zero, one or more photos a dish : Zero, one or more reviews  

this one Icsha makes sense for the application. If you poison food with egg salad in Restaurant A, then it does not make any sense for Negative Review of dish shown under Restaurant B.

Here are some example rows for each table.

Restaurant (REST_ID, name, chef)

  1 "McDonald's" Ronald 2 "Place of Julia" Julia 3 "Ritz Carlton Dining Room" Jack  / Pre> 

buffet (REST_ID, BUFFET_ID, name)

  2 1 "soup bar" (this is the replacement of Julia soup bar) 2 2 "salad bar" (location of julia 3 "Sweets" (sweet bar in the hotel's dining room)  

Dish: (REST_ID, the salad bar at the hotel's dining room) 3 1 "cold breakfast" BUFFET_ID, DISH_ID, name and category)

  2 1 1 "Minimum" "Soup" 2 1 2 "French Onion" "Soup" 2 1 3 "Vegetarian Barley" "Soup" 2 1 4 "Salts" "Crackers" 3 1 1 "Melon" "Fruit" 3 1 2 "Strawberry" "Fruits" 3 1 3 "blueberry muffin" "bread" 3 1 4 "multigrain bread" "bread" 3 1 5 "corn flakes" "grain" 3 1 6 "orange e juice" "p" 3 1 7 "milk" "P"  

etc.


Comments