我的数据库架构是否完全规范化了?

时间:2011-07-17 21:48:11

标签: database design-patterns

产品

+----------------+----------------+--------+-------+----------+----------------+
|Field           |  Type          |  Null  |  Key  | Default  |  Extra         |
+----------------+----------------+--------+-------+----------+----------------+
|id              |  int(11)       |  No    |  PRI  | Null     | auto_increment | 
|modelNumber     |  varchar(150)  |  No    |       |          |                |
|manufacturer_id |  int(11)       |  No    |       |          |                |
|name            |  varchar(100)  |  No    |       |          |                |
|department_id   |  int(11)       |  No    |       |          |                |
|class_id        |  int(11)       |  No    |       |          |                |
|subclass_id     |  int(11)       |  No    |       |          |                |
+----------------+----------------+--------+-------+----------+----------------+

DEPARTMENT_ID

+---------------+----------------+--------+-------+----------+-------------+
|Field          | Type           | Null   | Key   | Default  | Extra       |
+---------------+----------------+--------+-------+----------+-------------+
|department_id  | int(11)        |        |  PRI  |          |             |
|name           | varchar(100)   |        |       |          |             |
+---------------+----------------+--------+-------+----------+-------------+

制造商

+----------------+----------------+--------+-------+----------+---------------+
|Field           | Type           | Null   | Key   | Default  | Extra         |
+----------------+----------------+--------+-------+----------+---------------+
|manufacturer_id | int(11)        |        |  PRI  |          |               |
|name            | varchar(100)   |        |       |          |               |     
+----------------+----------------+--------+-------+----------+---------------+

+-----------+----------------+--------+-------+----------+----------+
|Field      | Type           | Null   | Key   | Default  | Extra    |
+-----------+----------------+--------+-------+----------+----------+
|class_id   | int(11)        |        | PRI   |          |          |
|name       | varchar(100)   |        |       |          |          |
+-----------+----------------+--------+-------+----------+----------+

子类

+---------------+----------------+--------+-------+----------+------------+
|Field          | Type           | Null   | Key   | Default  | Extra      |
+---------------+----------------+--------+-------+----------+------------+
|subclass_id    | int(11)        |        |  PRI  |          |            |
|name           | varchar(100)   |        |       |          |            |
+---------------+----------------+--------+-------+----------+------------+

我无法完全控制如何获取数据,因为我通过XML获取大量数据。我需要创建一个允许我扩展的数据库。

1 个答案:

答案 0 :(得分:0)

如果classidsubclassid无关,则它位于3nf而不是BCNF,因为modelNumber不是dependency id。但如果它们相关,那么即使在3nf

中也是如此