【发布时间】:2011-10-03 01:34:30
【问题描述】:
我的数据库中有一个名为Resource 的表。这包含有关资源的通用信息(资源可以是文章、静态网络链接、YouTube 视频或任何数量的其他类型)。
以我为例:
表:资源
primary key - id,
column - type,
column - title,
column - description,
column - created_on,
column - updated_on
表:resource_video
primary key - id,
column - youtube_id (spose this could be the primary key, but not relevant in the question).
column - ...
表:resource_weblink
primary key - id,
column - url
column - ...
所以基本上resource 表包含通用(适用于所有资源)、列,然后设置表以保存resource_type 特定数据。在resource 和resource_type 之间建立关系的最佳(标准化)方法是什么。
我的第一直觉是,它应该是在resource_video 和resource_weblink 表中具有resource_id 外键的两个表之间的一对一识别关系,或者是否有更好的方法来处理这个问题情况?
【问题讨论】:
标签: mysql relational-database normalization