0

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/ Chiptole ERD Design

11
  • What's with this 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.
    – mustaccio
    Commented Nov 30, 2022 at 17:13
  • Yikes. I'm just trying to learn and just asking for help, no need to be aggressive. I appreciate the feedback on removing "tb_" from the names. I put them there to show it will be a table in the db with the following attributes. Removing the 's' from the tables makes sense. Again, a rough draft, but I wanted to see if the overall structure made sense or where improvement to the relation could be made. Can you elaborate on the cardinality between meal and topping? Commented Nov 30, 2022 at 18:12
  • You are running ahead of yourself, thinking about tables. An ERD is a tool for logical modelling, which deals with abstract entities. You turn to the physical modelling, where tables and other things appear, once your logical model is complete and consistent. Not sure what you want to know about toppings; I don't know how many toppings that Chipotle guy allows you to choose, but you probably do. So, how many? That would be your cardinality.
    – mustaccio
    Commented Nov 30, 2022 at 19:32
  • 1
    Drop the id columns, they are a physical consideration (row identifiers) and not actual data. If you do use them (say, for User), 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.
    – user212533
    Commented Nov 30, 2022 at 19:47
  • @mustaccio, understood on the part for what ERD is aimed for. A meal can have multiple different toppings, like guacamole, fresh tomato salsa, fajita veggies, etc, but you can't have like 2 guacamoles for one meal. Commented Nov 30, 2022 at 22:03

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.