在线订购系统的数据库设计
在设计网上商店数据库时,我遇到了一个零件问题,请问有人可以给我建议吗?它设计是否正确?这个想法是有些产品可以分配到类别。每个类别都有一组参数,以便客户更轻松地搜索产品。例如,类别“CPU”将具有参数“cpu 系列”、“cpu 速度”,类别“HDD”将具有“外形尺寸”和“主轴速度”。这些参数名称存储在表 tbCatParam 中,每个产品的参数值存储在表 tbProdCatParam 中。
我的架构可在此处以 jpeg 形式提供: http://cid-ce0a6f63806e1ea9 .office.live.com/self.aspx/PuclicFolder/scheme.jpg
它会像这样工作吗?非常感谢
While designing an online shop database I had a problem with one part, could please someone give me an advise whether it is designed ok? The idea is that there are products which can be assigned to categories. Each category has a set of parameters for an easier search of products by customers. For example, a category "CPU" will have parameters "cpu family", "cpu speed" and category "HDD" will have "form factor" and "spindle speed". These parameter names are stored in the table tbCatParam and values of parameters for each product are in the table tbProdCatParam.
My schema is available here as jpeg: http://cid-ce0a6f63806e1ea9.office.live.com/self.aspx/PuclicFolder/scheme.jpg
Will it work like this? Many thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果表 TbProdCatParam 和 TbProdCat 之间没有关系,因为它是递归的,那就更好了。您正在关联 TbProdCat 和 TbCategories,它们与 tbCatParam 相关。因此,如果 tbCategories 有参数,则在 tbCatParam 和 tbProdCat 之间创建另一个 NxN 关系是没有意义的,它本身就是一个 NxN 表。
这样,您甚至不需要表 tbProdCatParam(除非您在产品和类别中都需要 paramCategories,但没有意义)。
If woul be better if you have no relation between tables TbProdCatParam and TbProdCat, for its recursive. You are relating TbProdCat and TbCategories, wich is related with tbCatParam. Thus, if the tbCategories has parameters, makes no sense you create another NxN relation between tbCatParam and tbProdCat, wich is a NxN table for itself.
This way, you even not need the table tbProdCatParam (unless you need paramCategories in both products and categories, but makes no sense).