Answer the question
In order to leave comments, you need to log in
How to correctly determine the relationship between database tables?
Good day to all! I read a lot of information on determining relationships between database tables, but my case causes me difficulties.
There is a table with goods:
There is also a sales table:
The system does not take into account the buyers themselves, because this is for an application for internal use in the store, but it is important which seller sold the goods (therefore seller_id is a foreign key id (user_id)).
Question:how to create a connecting table between products and orders (and is it necessary), if, in fact, a specific order (receipt) can contain not only a different product, but also a different quantity of each of the products? How to organize such a connection? Where to store the column with the quantity of each item? Each record in the sales table is, in fact, a specific receipt with goods and its own identifier. How, then, is insert performed when placing a new order?
Thank you in advance.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question