一般來說,你不應該;而是創建一個activity_resources
表。該表可以允許多行引用同一活動,並使用每行存儲單獨的資源。
activity:
- identifier field (often an auto-increment, but perhaps "serial" in this case)
- fields for "fixed" activity data, such as: name, perhaps date started;
basically any values all activities are expected to have in fixed quantities.
activity_resources:
- activity identifier
- resource value|data
如果資源可在多個活動之間共享,而不是有一個resources
表(保存資源),並使用表activity_resources
一種用於M:N關係;在這種情況下,表格的行將引用活動和資源表。
activity:
- identifier field (often an auto-increment, but perhaps "serial" in this case)
- fields for "fixed" activity data, such as: name, perhaps date started;
basically any values all activities are expected to have in fixed quantities.
resource:
- identifier field
- resource value|data
activity_resources:
- activity identifier
- resource identifier