Given: product control system. There are supplies and there are sales. Necessary: to ensure data integrity.
In more detail: there is a table sale_products. It has a product ID and a sales ID. There is a table of products, it has the name of the product. There are several questions, namely:
How more correct: create a column in the products table and add / decrease the value depending on the sale / delivery
How to make a delivery table? There is a product that will be rejected, i.e. it is also necessary to make a write-off of goods
Do I need to make different tables of goods written off and goods delivered? I wanted to do this: the table is one, it has a type column, where 1 is delivery, 2 is write-off
Thank you all in advance for your help!