发票数据库设计
发票数据库设计,可能看起来像这样...... http://www.databaseanswers.org/data_models/invoices_and_ payments/index.htm
现在,如果用户决定更改/修改产品代码/描述,
它将更改以前的订单和发票产品代码/描述:(
你会做什么?将产品代码描述复制到发票表中?
The invoice database design, might look something like this...
http://www.databaseanswers.org/data_models/invoices_and_payments/index.htm
Now If the user decides to change/revise the product code/description
It will change the previous order and invoice produce code/description :(
What do you do? Copy the product code description to the invoice table instead?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您基本上有两个选择:
Products
表设置为“启用时间”(也称为“时态数据库”),例如将单个产品的“先前”状态保留在表中,并且为每个条目提供一个ValidFrom / ValidTo
日期对。这样,如果您更改产品,您将获得一个新条目,并且前一个条目保持不变,并引用使用该条目的发票;仅更新产品的ValidTo
日期,或者:
请参阅其他 关于时态数据库的 Stackoverflow 问题 作为另一个输入,另请参阅有关 Simple-Talk 的这篇文章:数据库设计:时间点架构
You basically have two options:
Products
table "time-enabled" (also known as "temporal database"), e.g. you keep the "previous" state of your individual product in your table, and you give every entry aValidFrom / ValidTo
pair of dates. That way, if you change your product, you get a new entry, and the previous one remains untouched, referenced from those invoices that used it; only theValidTo
date for the product gets updatedor:
See this other Stackoverflow question on temporal databases as another input, and also check out this article on Simple-Talk: Database Design: A Point in Time Architecture