I am designing database architecture. I have user. User make request for order. Order is associated with payment. Once payment is completed, I want to generate sticker for that user.
Sticker has initial prize(i.e. $10). Now, admin can edit sticker prize. so, if admin change sticker prize then order will generate with new prize after change by admin.
我正在设计数据库架构。我有用户。用户请求订单。订单与付款相关联。付款完成后,我想为该用户生成贴纸。贴纸有初始奖金(即10美元)。现在,管理员可以编辑贴纸奖品。所以,如果管理员更换贴纸奖品,那么在管理员更改后,订单将生成新的奖品。
By database architecture is as follow :
按数据库架构如下:
User(id, name, email, password)
Order(id, user_id, no_of_sticker,sticker_prize, address, status)
Payment(id, order_id, amount, date)
sticker(id, order_id, name, content)
sticker_info(sticker_prize)
用户(ID,姓名,电子邮件,密码)订单(id,user_id,no_of_sticker,sticker_prize,地址,状态)付款(id,order_id,金额,日期)贴纸(id,order_id,名称,内容)sticker_info(sticker_prize)
Now, my question is--- is it good to create new table for just one single attribute. That sticker_prize is only available for admin to edit
现在,我的问题是---只为一个属性创建新表是好的。该sticker_prize仅供管理员编辑
Please give your valuable suggestion.
Thanks in adv.
请提出宝贵的建议。谢谢你。
1 个解决方案
#1
1
Creating the sticker_info table, for the purpose of storing a single value is ok from a database design perspective. You should ensure you have a primary key on the table so you can not get duplicate rows.
从数据库设计的角度来看,创建sticker_info表是为了存储单个值。您应该确保在表上有一个主键,这样就无法获得重复的行。
In larger systems, there are often lots of values like this, and often the solution is a table like: configuration( configId, configValue )
.
在较大的系统中,通常有很多这样的值,并且解决方案通常是一个表:configuration(configId,configValue)。
#1
1
Creating the sticker_info table, for the purpose of storing a single value is ok from a database design perspective. You should ensure you have a primary key on the table so you can not get duplicate rows.
从数据库设计的角度来看,创建sticker_info表是为了存储单个值。您应该确保在表上有一个主键,这样就无法获得重复的行。
In larger systems, there are often lots of values like this, and often the solution is a table like: configuration( configId, configValue )
.
在较大的系统中,通常有很多这样的值,并且解决方案通常是一个表:configuration(configId,configValue)。