Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I know that:

No, you would never store a value that could be calculated from other columns in the database. Storing calculated values is a violation of database normalization.

But what about the calculated value from the relational table? For example, amount in orders is calculated from the order_products table with the formula sum (price * qty). Should I save this value in the orders table?. Thanks.

question from:https://stackoverflow.com/questions/66059496/mysql-should-a-field-be-created-to-store-the-relational-table-calculation

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
15.7k views
Welcome To Ask or Share your Answers For Others

1 Answer

Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...