Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/69.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
这个sql表定义和关系是否正确?_Sql_Database Design - Fatal编程技术网

这个sql表定义和关系是否正确?

这个sql表定义和关系是否正确?,sql,database-design,Sql,Database Design,问题不大,但逻辑有时很难,所以也有同样的问题。我必须将客户数据保存到sql表中。客户记录在excel shet中如下所示。合同期限为6个月或12个月。每个客户在一个月后分期付款。每月有两次记录分期付款金额和佣金金额。excel工作表有如下记录数据 SR, CustomerID, Customername, CompanyName, relationType, ContractStartDate, ContractDuration, TotalInstallment, Comission, pay

问题不大,但逻辑有时很难,所以也有同样的问题。我必须将客户数据保存到sql表中。客户记录在excel shet中如下所示。合同期限为6个月或12个月。每个客户在一个月后分期付款。每月有两次记录分期付款金额和佣金金额。excel工作表有如下记录数据

SR,
CustomerID,
Customername,
CompanyName,
relationType,
ContractStartDate,
ContractDuration,
TotalInstallment,
Comission,
paymentMode,
JanuaryInstallment,
JanuaryCommision,
...
DecemberMonthInstallment,
DecemberMonthCommision
为此,我在sql中定义了以下表:

这些桌子的摆放方式正确吗?我对月名记录感到困惑,我是否将它与每一期一起放入分期付款表中,如(
firstInstallmentMonth
firstinstallmentcommission
firstinstallmentcommission

我很困惑,给我引路吧,高年级的学生们?

我建议读一下:

我会把月份放在“分期付款”表中,因为每期付款都有不同的月份

我建议阅读以下内容:


我会把月份放在“分期付款”表中,因为每期付款都有不同的月份

我想你应该将分期付款表标准化为

Table INSTALMENT
    contract_id     -- FK to contract table
    date            -- used to specify month and date
    instalment      -- the instalment amount
    commission      -- the commission amount
    primary key (contract_id, date)
您可以浏览excel工作表,为每期创建一个条目(注意,这是伪代码):

等等


EDIT2:将伪
添加到_date
日期格式以避免混淆。

我认为您希望将分期付款表标准化为类似的格式

Table INSTALMENT
    contract_id     -- FK to contract table
    date            -- used to specify month and date
    instalment      -- the instalment amount
    commission      -- the commission amount
    primary key (contract_id, date)
您可以浏览excel工作表,为每期创建一个条目(注意,这是伪代码):

等等


EDIT2:将伪
添加到_date
日期格式以避免混淆。

分期付款表未正确规范化。看看如何划分第一、第二、第三组等等分期付款表没有正确规范化。看看把第一,第二,第三个练习分成几组这是我要谢谢这是我要谢谢