i have a database where i have some types of pizza, and their composition(stored in Reteta, in numeComponenta). e.g.: sauce,mayonnaise,mushrooms, etc, for each pizza.
And i also have an Incompatibilities table, where i have id1 and id2, and i wanna, for example if id1=3 and id2=6, the components 3 and 6 to be incompaible. how can i do this?
so, for example i have:
if in Incompatibilitati id1=1 and id2=2, sauce and mayonnaise are incompatible, and i cannot insert them into a pizza, as composition
i have this problem just at the relationship between Incompatibilitati and Componente, other relations are ok.
as far as this incompatibility doesn't follow any logic and is depend on cook decision, if it was up to me I would leave the component selection to chef or try to give a logic to it to be able to help you.
ok, i'll describe my problem in plain text:
so i have to manage the activity into a pizzery.
i have made the tables, and i also added an Incompatibility table(with 2 columns, id1 and id2). i have also the table Componente (Components), with idComponent and componentName (e.g. mayonnaise, sauce, etc)
if id1=4 and id2=3 for example, i wanna that the name of the components with id 4 and 3 to be incompatible(i cannot operate with them, i cannot attribute to a pizza 2 incompatible components)
i have attached the diagram, so what i need more in this diagram, to make it functional?
p.s. Reteta is the intermediary table between pizza and Components, relation between pizza and Componente being n:m