结点 table vs 链接 table vs 加入 table vs 桥接 table
Junction table vs linking table vs joining table vs bridging table
我最近想弄清楚如何在我的数据库中建立多对多关系。在我访问过的众多网站(例如 this one)中,它们似乎都使用不同的术语来指代同一事物,一个 table 包含来自两个单独的 ID tables 用于定义关系。例如,一本书可以有很多作者,一个作者可以有很多书,linking/bridging/joining/juntion table 看起来像:
+------------+-----------+
| book_id | author_id |
+------------+-----------+
| 1 | 1 |
| 2 | 2 |
| 3 | 3 |
| 3 | 5 |
| 4 | 5 |
+------------+-----------+
这样的 table 接受的条款是什么,或者所有条款都接受table?
路口 Table.
来自Wiki:
An associative (or junction) table maps two or more tables together by referencing the primary keys of each data table. In effect, it contains a number of foreign keys, each in a many-to-one relationship from the junction table to the individual data tables. The PK of the associative table is typically composed of the FK columns themselves.
我最近想弄清楚如何在我的数据库中建立多对多关系。在我访问过的众多网站(例如 this one)中,它们似乎都使用不同的术语来指代同一事物,一个 table 包含来自两个单独的 ID tables 用于定义关系。例如,一本书可以有很多作者,一个作者可以有很多书,linking/bridging/joining/juntion table 看起来像:
+------------+-----------+
| book_id | author_id |
+------------+-----------+
| 1 | 1 |
| 2 | 2 |
| 3 | 3 |
| 3 | 5 |
| 4 | 5 |
+------------+-----------+
这样的 table 接受的条款是什么,或者所有条款都接受table?
路口 Table.
来自Wiki:
An associative (or junction) table maps two or more tables together by referencing the primary keys of each data table. In effect, it contains a number of foreign keys, each in a many-to-one relationship from the junction table to the individual data tables. The PK of the associative table is typically composed of the FK columns themselves.