remove product from product table that is related to sales note

0

Hi, I'm a newbie in web programming and I just finished my first website in my professional practice and the company was satisfied, only my question is for example I have my BD which has a table related to a table. sale, the doubt in particular if it is correct to remove the product from my product table or I can only unsubscribe it, since as my table is related to products I do not know if it causes any error or what happens with that sales notes that already are old and have a product associated that is no longer for sale that is done in that case you have to eliminate the product from my product table permanently or just add a field in my product table that is called active or inactive so that it does not show if you do not want to sell that product in the future, greetings!

    
asked by jose 31.05.2018 в 05:47
source

1 answer

0

The idea of an SQL database is to keep all the information related, so, it is best to keep the products in the table and manage a "status" column (as you say) where you activate and deactivate the product.

If you delete a product and use constraints, you can delete the notes related to the product.

Greetings!

    
answered by 06.06.2018 / 03:54
source