首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >(数据库设计,mysql)我的数据库设计适合基本购物车吗?(我是数据库设计新手)

(数据库设计,mysql)我的数据库设计适合基本购物车吗?(我是数据库设计新手)
EN

Stack Overflow用户
提问于 2010-05-25 18:55:10
回答 2查看 1.2K关注 0票数 1

我是数据库设计的新手,我想确保我能把它做好。请看一下我数据库设计的一部分:

我的基本购物车数据库设计:

代码语言:javascript
复制
//table that holds shopping cart items that customer choose(not press checkout and order //them)

**shopping_cart**
{
id (int)
product_id (int) fk
product_quantity (int)
customer_user_id (int) fk 
}

//table that holds product order data in time of checkout.(i hold them because supplier //can change after time products attributes value add some attributes or delete and change //the price of product)

**order**
{
id (int)
product_id (int)  fk
customer_user_id (int)  fk
}


//table that connect order  to attribute table for products attributes value in the moment //of   checkout

**order_attributes**
{
id (int)
order_id (int)  fk
attribute_id (int)  fk
}

//main product table
**product**
{
id (int)
sku (int) 
product_name (varchar)
supplier_user_id (int)  fk
}

//connection table many to many 
**product_attributes**
{
id (int) 
product_id (int)  fk
attribute_id (int)  fk
}

//table that holds products attributes (price, weight, color + new attributes that user //will create)

**attribute**
{
id (int)
product_id (int)  fk
attribute_name (varchar)
attribute_value(varchar)
}

谢谢你

EN

Stack Overflow用户

发布于 2010-05-26 01:30:52

嗯,你可以从你的设计中删除两个表: order_attributes,product_attributes。否则,您的select查询将非常慢,必须连接这么多表。您可以将属性存储为order和product表中的列。

票数 2
EN
查看全部 2 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/2903931

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档