Answer the question
In order to leave comments, you need to log in
How to place a product, an attribute, and a different price depending on the attribute in one sqlite table?
There is a small pizzeria project - pizza has 3 attributes (big, normal, small), and each attribute forms its own price for pizza. I thought that it makes no sense to look towards complex solutions like EAV for such a task. I suspect that this can be solved using mongodb (json). But is it possible to do this in sqlite, or rather, the question is whether it is advisable to do this in sqlite or mysql? Or is Mongo better?
Answer the question
In order to leave comments, you need to log in
It is better to make two tables instead of one. In the first one, store the main data that does not change (for example, the name), and in the second - individual options for this pizza with a price (for each option, a separate entry in this table).
pizzas
id | name
pizzas_variants
id | pizza_id | price
pizza has 3 attributes (big, normal, small)Since the attributes are mutually exclusive, keep the
размер, цена1, цена2, цена3
.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question