Java 非常简单的网店数据库设计

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9727143/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-16 06:47:00  来源:igfitidea点击:

Very simple online shop database design

javadatabasedatabase-designmysql-workbench

提问by ASD

I need to create a simple database for simple online shop. I crated the following one desing scheme, but I am not sure about correctness of it. Does it correct? What are mistakes?

我需要为简单的在线商店创建一个简单的数据库。我创建了以下一个设计方案,但我不确定它的正确性。它正确吗?什么是错误?

Like here:

像这儿:

http://netbeans.org/kb/docs/javaee/ecommerce/data-model.html

http://netbeans.org/kb/docs/javaee/ecommerce/data-model.html

enter image description here

在此处输入图片说明

but I want to add shopping cart

但我想添加购物车

采纳答案by Michael Fredrickson

I see one potential issue:

我看到一个潜在的问题:

If a userhas one shopping_cart, and a shopping_carthas one user, should ordercontain both user_idand shopping_cart_id?

如果 auser有一个shopping_cart,ashopping_cart有一个user,应该同时order包含user_idshopping_cart_id?

What ensures that these two IDs in this table reference a userand shopping_cartthat are also associated with each other?

什么确保此表中的这两个 ID 引用 auser并且shopping_cart它们也彼此关联?

EDIT:

编辑:

I would just get rid of shopping_cart, since it only contains totals that you would probably be better off calculating based on the current contents of the order.

我只想摆脱shopping_cart,因为它只包含您可能最好根据订单的当前内容进行计算的总数。