更新客户详细信息

发布于 2024-10-07 03:44:36 字数 358 浏览 2 评论 0原文

我有一个网站,其中存储客户详细信息、姓名、地址、联系方式等。客户可以通过表格更新自己的详细信息。实现这一点的最佳实践是什么?

我是只对现有数据使用UPDATE 语句,还是有 详细信息?

这让我思考,假设当客户更新他们的详细信息时是否使用亚马逊等网站。如果详细信息不正确怎么办?亚马逊是否有旧详细信息的记录作为备份?

例如客户可以住在假街 999 号。另外,如果出现问题并且由于提供了新的更新详细信息而无法联系客户怎么办?例如,客户接受服务并避免付款。

我应该只更新客户信息,还是应该将旧数据移动到另一个表中然后更新?

希望我没有问太多明显的问题,谢谢。

I have a website which stores customer details, name, address, contact etc. A customer can update their own details via a form. What are the best practices for implementing this?

Do I just use an UPDATE statement over the existing data, or do I have old and new details?

It got me thinking, say if using a webiste such as amazon when a customer updates their details. What if the details are not correct? Do amazon have a record of the old details as a backup?

Such as a customer could live at 999 Fake Street. Also what if a problem occurs and the customer cannot be contacted because of the new updated details given? For example the customer receives a service and avoid paying.

Should I just update customers information, or should I move the old data into another table then update?

Hope I haven't asked too much of an obvious question, thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

一抹苦笑 2024-10-14 03:44:36

Elliott,您正在寻求的数据库设计必须基于业务规则。 Facebook、Twitter、亚马逊或 Mom's Pizza 的 DBA 没有确定要保留多少旧地址。向 BA 询问有关地址的规则。如果答案是“仅保留当前地址”,则实施您在问题中提到的更新语句。如果 BA 给你一个茫然的眼神,那么为每次更新插入新行并显示最新的计时记录,并且永远不要删除任何内容。

当 DB A 收到一套完整的业务规则时,才可以开始设计。

Elliott, the database design you are seeking must be based on business rules. The DBA at facebook, twitter, amazon or Mom's Pizza did not dedtermine how many old addresses to keep. Ask the BA for the rule on address. If the answer is "keep only a current address" then implement the UPDATE statement you mentioned in the question. If the BA give you a blank stare then insert new rows for every update and display the latest chrono record and NEVER delete anything.

When the DB A recieves a complete set of business rules only then should the design begin.

守望孤独 2024-10-14 03:44:36

将字段添加到您的客户表 InfoDate 或类似的表中。然后,您可以通过视图访问数据,该视图仅显示每个客户的记录,其中 InfoDate 是该客户的最大值。

您可以保留所有数据,而无需迁移到另一个表进行归档的复杂过程,并且可以通过直接查询表而不是视图来轻松访问历史数据。

Add a field to your customer table InfoDate or something similar. Then you can access the data via a view that only shows you the record for each customer where the InfoDate is the max value for that customer.

You keep all your data without a complicated process of migrating to another table for archiving, and you can access historical data easily by directly querying the table instead of the view.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文