我希望有人可以帮我解决我想要实现的数据库架构。它基于从网络提供商销售移动合同和网络螺栓。合同由多个经销商预先填写,这些经销商可能会或可能不会出售网络合同,每个经销商的价格也不同。
Distributors
Name Address
Distributor 1 address1
Distributor2 address2
Networks
Name
Orange
O2
Vodafone
Tariffs
Network Tariff Minutes
Orange Business 600 600 Mins
Orange Business 100 100 Mins
O2 Everyday 100 200 Mins
O2 Everyday 100 100 Mins
Devices
Name Make
Apple Iphone
Samsung Galaxy
Bolt Ons
Network Description
Orange Web 500mb
Orange Unlimited Texts
O2 Web 250Mb
O2 Unlimited Texts
Order - Exactly 1 Distributor - Exactly 1 Network - Exactly 1 Tariff - 0 or more Devices - 0 or more Bolt Ons Distributor - 0 or more Orders - 1 or more Networks - 1 or more Tariffs o Unique Tariff Costs - 1 or more BoltOns o Unique Bolt on Cost - 1 or more Devices o Unique Device cost Network - 0 Orders - 0 or more Distributors - 1 or more Tariffs - 0 or more BoltOns - 0 or more Devices Tariffs - 0 or more Orders - 0 or more Distributors - Exactly 1 Network - 0 or more BoltOns - 0 Devices BoltOns - 0 or more Orders - 0 or more Distributors - Exactly 1 Network - 0 or more Tariffs - 0 or more Devices Devices - 0 or more Orders - 0 or more Distributors - 0 or more Networks - 0 Tariffs - 1 or more BoltOns
我想出了2个架构,但我真的不满意。主要是由于分销商可能不提供来自网络的所有产品。关税,设备和螺栓的价格也因经销商而异。我希望对模式方法有一些建议吗?
非常感谢
罗布
EDIT -------- 按照我的评论,我已经与以下的shema相提并论。我已经添加了以下假设
设备和Boltons足够相似,可以放在产品表中:
我们需要运行的查询类型是根据用户6-12个月前支付的费用生成发票 - 分销商的价格可能每月更改。
每个网络每个分销商销售的手机数量等......
对以下架构的任何评论?
[Distributors]
[Dist_ID] PK
[Name],
[Address]
[Network]
[Network_ID] PK,
[Name],
[Tarrif]
[TariffID] PK
[Name],
[Minutes] ,
[OtherMinutes] ,
[Texts] ,
[Data],
[Term] ,
[Active] BIT,
[TariffsByDistributor]
[TariffsDistributorID] PK
[DistID] FK
[TariffID] FK
[RevShare],
[Commision],
[Cost],
[Active]
[Product_Type]
[Product_Type_ID] PK,
[Name],
[Details],
[TariffsByNetwork]
[Network_ID] PK,
[TariffID] PK,
[Order] (
[Order_Id] PK,
[Customer_Id],
[Date Sold],
[PaymentStatus],
[PaymentStatusDate],
[TariffOrders] (
[Order_Id] PK,
[TariffsDistributorID] PK,
[RevenueShare],
[Commision],
[Cost],
[Products] (
[Product_Id] PK
[Product_Type_ID] FK,
[Name],
[Manufacturer],
[Colour]
[Picture],
[Active] BIT,
[ProductByDistributor]
[ProductsByDistributorID] PK,
[Dist_ID] FK,
[Product_Id] FK,
[RevShare],
[Commision],
[Cost],
[Active],
[ProductsOrder]
[Order_Id] PK,
[ProductsByDistributorID] PK,
[RevenueShare],
[Commision],
[Cost],
[Products_Network]
[Network_ID] PK,
[Product_Id] PK,
答案 0 :(得分:0)
您正在完成您的架构,因为您正在确定分销商与产品,分销商和定价之间的关系。
我首先添加一个与分销商和关税有关系的DistributorTariff表。然后,寻找其他限制,如TariffPrice等,并在那里建立表。
如果您了解所有关系规则,您可以先在纸上设置它。如果您分享所有规则,我可以帮助您进一步完善您的设计。
关于您的架构
看起来不错。在此阶段规范化数据库可能看起来额外的复杂性将在以后节省您的麻烦。我会提出以下建议:
希望有所帮助。我很乐意详细说明任何问题。