【发布时间】:2012-02-27 07:27:29
【问题描述】:
您会为自定义费用表的数据库选择哪种设计?为什么?
选项1)1表,UserId判断用户是否有自定义费用
ACCOUNT_FEE
TypeId
FixedRate
VariableRate
CurrencyId
UserId (UserId is null for default account fee, UserId is present for custom fee)
选项 2) 2 个单独的表格,一个用于默认费用,另一个用于用户自定义费用
ACCOUNT_DEFAULT_FEE
TypeId
FixedRate
VariableRate
CurrencyId
USER_ACCOUNT_FEE
TypeId
FixedRate
VariableRate
CurrencyId
UserId
【问题讨论】:
-
“Userid”对于每个用户来说都是唯一的,如果是这样,它怎么可能是空的,你将如何区分用户