请输入您要查询的百科知识:

 

词条 Many-to-many (data model)
释义

  1. See also

  2. References

{{refimprove|date=January 2013}}

In systems analysis, a many-to-many relationship is a type of cardinality that refers to the relationship between two entities[1] A and B in which A may contain a parent instance for which there are many children in B and vice versa.

For example, think of A as Authors, and B as Books. An Author can write several Books, and a Book can be written by several Authors.

In a relational database management system, such relationships are usually implemented by means of an associative table (also known as join table, junction table or cross-reference table), say, AB with two one-to-many relationships A -> AB and B -> AB. In this case the logical primary key for AB is formed from the two foreign keys (i.e. copies of the primary keys of A and B).

In web application frameworks such as CakePHP and Ruby on Rails, a many-to-many relationship between entity types represented by logical model database tables is sometimes referred to as a HasAndBelongsToMany (HABTM) relationship.[2]

See also

  • Associative Entities
  • One-to-one (data model)
  • One-to-many (data model)

References

1. ^Also see entity–relationship model.
2. ^3.7.6.5 hasAndBelongsToMany (HABTM) {{webarchive|url=https://web.archive.org/web/20120815165131/http://book.cakephp.org/1.3/view/1044/hasAndBelongsToMany-HABTM |date=2012-08-15 }}. Cakephp.org

1 : Data modeling

随便看

 

开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。

 

Copyright © 2023 OENC.NET All Rights Reserved
京ICP备2021023879号 更新时间:2024/9/22 13:31:52