gpt4 book ai didi

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

转载 作者:搜寻专家 更新时间:2023-10-30 22:21:37 28 4
gpt4 key购买 nike

我是数据库设计的新手,我想确保自己做得很好。请看一下我的数据库设计的一部分:

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

//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)
}

谢谢

最佳答案

嗯,您可以从设计中删除两个表:order_attributes、product_attributes。否则,您的选择查询将非常慢,必须从这么多表中加入。您可以将属性存储为订单和产品表中的列。

关于mysql - (数据库设计,mysql)我的数据库设计适合基本的购物车吗?(我是数据库设计的新手),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2903931/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com