I have a database that includes the names of the restaurants and the menus of restaurants and dishes in each restaurant.
Now I want to specify what every food is served in what days and when.
So I acted as follows. Is this the right way?
Assume that each restaurant has several menus, for example, the breakfast menu dinner menu lunch menu. In this case, each menu will be released at a specific time.
Now, if the breakfast menu is served on Fridays, Saturdays, Sundays, Mondays, Tuesdays, Wednesdays, and Wednesdays, from 8 to 10 in the morning, and Sundays of 8.5 to 11, how can I do with a few simple design columns?
(Alternatively, have a DayStart and DayEnd as well, which is the more likely scenario: a menu is served every day during the week, which would reduce your number of rows to 3 instead of 7.)
Your code interpreter can translate day # and hours without the need for ancillary tables.
SELECT R.name
FROM Restaurant R
INNER JOIN Menu M
ON R.Id = M.RestId
INNER JOIN Food F
ON F.MenuId = M.Id
WHERE F.Name = "The Meal"
(Note the lack of use of F.RestId)
‘Food’ is perhaps a misnamed table, as it more accurately represents ‘Dish’ or ‘MenuItem’, and ‘Stuff’ would be ‘Ingredient’, but that’s just playing with names.