I'm making a JavaFX desktop application. It's a Point of sale system that tracks orders in a restaurant. I am very new to this and things got confusing after I fired up my phpmyadmin to create my database.
This is the relevant part of my UML :
Some examples to clarify the tables' content :
Ingredienttable may contain : Flour, sugar, beef, eggs...ArticleMenutable may contain : Pizza, Burger...ArticleMenuis made of a bunch of ingredients , but these ingredient can still exist on their own, so it's an aggregation I thought.
The issue is to translate this into a relational database, and especially the aggregation.
What I tried :
in ArticleMenu, the 'recette' attribute is a FK that refrences a row from Ingredient table, the 'recette' attribute is of type ENUM , which can hold many values the user defines when creating a row in ArticleMenu.
Example :
ArticleMenu table has a row that represents let's say Pizza, one of it's attributes is recette of type ENUM and has the values "Cheese, flour, yeast, onions, tomato, mushroom, oil"
My question : is this an acceptable way of representing an aggregation and what would be the most optimal way?
Edit :
After reading Christophe's answer it's clear that I did not
understand what ENUM is.
The IBM document he linked cleared a lot of confusion I had relating to this topic.
Stock information shouldn't be part of the ingredient table since
there could be many states of the same ingredient, so I removed
those.
As for the quantities used in each recipie, those will be represented
using the quantity attribute from the recipie table.
