English 中文(简体)
产品线、类别、制造商、相关软件、产品属性等产品数据库设计
原标题:Products database design for product lines, categories, manufacturers, related software, product attributes, etc

我正在重新开发中型产品数据库的前端和数据库,以便支持类别/子类、产品线、制造商、支持的软件和产品属性。 现在只有一个产品表。 制造商将通过辅助软件(选择)按类别/子类别列出产品页。 每个网页将根据其他分类进行额外的过滤。

Categories/Subcategories (multi level) Products and product lines can be assigned to multiple category trees. Up to 5 levels deep should be supported.

Product lines (single level) Groups of products. Product can only be in single product line.

Manufacturers (single level) Products and product lines can be assigned to single manufacturer.

Supported software (single level) Certain products only work with one or more softwares, so a product/line can be assigned to none, one or more softwares.

Attribues (type / options - could be treated so each type is a category and items are children) Products and product lines can be assigned attributes (eg - color > red / blue / green). Attributes should be able to be assigned to one or more categories.

由于所有这些物品基本上都是子类,因此,我是否将其全部放在总表格中,或将其分成单独表格。

硕士:

ClassificationTypes (product line, category/sub, manufacturer, software, attribute would all be types)
-TypeID
-Name

Classifications
-ClassID
-TypeID
-ParentClassID
-Name

ClassificationsProductsAssociations
-ProductID
-ClassID

我仍然至少需要一个表格,把各种类型联系起来(例如将属性与一类联系起来),以及将产品线与各种类型联系起来。

如果我拿到每类表格的话,它就能够迅速获得,我仍需要一种把所有事项联系起来的办法。

表格设置:

Categories
-CategoryID
-Name
-ParentCategoryID

CategoriesAssociations
-CategoryID
-ProductID
-ProductLineID ?

Attributes
-AttributeID
-Name
-ParentAttributeID (use this as the parent would be "color" and child would be "red")

AttributesAssociations
-AttributeID
-ProductID
-CategoryID (do I also need to link the category to the parent attribute?)

CompatibleSoftware
-SoftwareID
-Name

CompatibleSoftwareAssociations
-SoftwareID
-ProductID
-ProductLineID ?

Manufacturers
-ManufacturerID
-Name

ProductLines
-ProductLineID
-ManufacturerID
-Name

Products
-ProductID
-ProductLineID
-ManufacturerID
-Name

社团的其他选择是设立一个单一的协会表格,将上述表格联系起来:

Master Associations
-ProductID
-ProductLineID
-ManufacturerID
-CategoryID
-SoftwareID
-AttributeID

什么是最佳解决办法?

最佳回答

我只想宣布我的决定,而且由于我对所提供的任何答复都不满意,我选择回答我自己的问题。

我最后设立了一套表格:

分类类型(例如产品线、类别、制造商等)

分类(支持父母/子女入学名单、nes套和一劳永逸地实现,以便利用各自的优势。 我有一个能够把所有领域集中起来的CQTE。

分类关系(有能力将产品与分类联系起来,将分类与其他分类联系起来,并将分类与其他类型联系起来)

我将承认,解决办法并不是100%的正常化,但这一安排使我具有最终的灵活性,可以通过创造新的类型扩大,并且非常强大和容易提出疑问。

问题回答

就多个表格而言,我认为,这会使设计更加明显,更便于使用。 虽然现在可能适合你的解决办法,但进一步的变化可能更加困难。

我同意帕迪。 这使你们的生活更加容易,而且你更加灵活。 你们可能想要控制库存和其他 st。 将所有内容联系起来,使用表格中的id(int)母子。

我认为,多张表格是前进的道路,但真正知道: 勾画两种方式的设计,然后抽取5-10种产品。

编制5-10种产品两种设计中的表格。

现在开始以两种方式撰写询问。 你们将开始看到哪一个更容易书写(单一表格一),而你可能发现,只有一种设计(多表一)。

当你不失去工作时——你可以利用表格表图示向前迈进,你的一些询问已经写成。

如果你去做一个没有意义、似乎复杂、或你能够在这里站出来回馈的问话——有真正的法典总是得到更好的评论。





相关问题
SQL SubQuery getting particular column

I noticed that there were some threads with similar questions, and I did look through them but did not really get a convincing answer. Here s my question: The subquery below returns a Table with 3 ...

难以执行 REGEXP_SUBSTR

I m 查询Oracle 10g。 我有两张表格(样本数据见下文)。 i m 试图提取一些领域

SQL Query Shortcuts

What are some cool SQL shorthands that you know of? For example, something I learned today is you can specify to group by an index: SELECT col1, col2 FROM table GROUP BY 2 This will group by col2

PHP array callback functions for cleaning output

I have an array of output from a database. I am wondering what the cleanest way to filter the values is example array Array ( [0] => Array ( [title] => title 1 ...

OracleParameter and DBNull.Value

we have a table in an Oracle Database which contains a column with the type Char(3 Byte). Now we use a parameterized sql to select some rows with a DBNull.Value and it doesn t work: OracleCommand ...

Running numbers in SQL

I have a SQL-statement like this: SELECT name FROM users WHERE deleted = 0; How can i create a result set with a running number in the first row? So the result would look like this: 1 Name_1 2 ...

How to get SQL queries for each user where env is production

I’m developing an application dedicated to generate statistical reports, I would like that user after saving their stat report they save sql queries too. To do that I wrote the following module: ...

热门标签