Attached is the ERD for my attempt at creating an ERD of Chipotles order system. I've been trying to learn how to make good ERD for database design and wanted to get some feedback.
I'm confused on some structural parts like the tb_meal to tb_meal_item, tb_protein, etc. Wondering if those relationships shown in the attached ERD breaks any normalization up to 3rd form or not. The options for creating a meal are finite, so there's going to be duplicate meals in tb_meal where the only varying factor is the incremental meal id. I suppose maybe the answer is to store all combinations of tb_meal, but then the lookup and association to an order seems like a waste of time unless I make all the combinations composite keys, but that seems like an adhoc solution? The cardinality stuff has me wondering if some many-to-one or many-to-many kind of relationships opt towards making a database un-normalalized. Here's the link to Chipotles website to kind of see where I'm coming from in terms of trying to model the ERD: https://www.chipotle.com/
tb_
crap? ERD stands for "entity-relationship diagram", so do you have a "tb_user" entity, or a "user" entity? Also,tb_meal
suggests that you only have one topping per meal; why is then the attribute name in plural? If instead you can have more than one topping, then your model is incorrect.id
columns, they are a physical consideration (row identifiers) and not actual data. If you do use them (say, forUser
), context is important. Always the entity name + id. You shouldn't have multiple tables for each ingredient, either have a table for ingredients and something that ties which options are available for each menu item. Subtypes may be involved.