Database Reference
In-Depth Information
Many-to-many relationships are quite common, and most of them will have intersection
data. The relational model does not directly support many-to-many relationships. In Rela-
tional database, some changes are required to map the conceptual model to the corres-
ponding logical model. The intersection data is mapped to a separate table (an intersection
table). The many-to-many relationship are mapped to two one-tomany relationships. The
intersection table is kept in the middle and on the "many" side of both relationships.
A pair of tables have many-to-many relationship when a single record in the X table can be
related to many records in the Y table and a single record in the Y table can be related to
many records in the X table. The relationship are established with a linking table. A linking
table makes it easy for database designer to link records from one table with those of the
other. It helps user to add, delete, or modify related data without any problem. A linking
table can be defined by taking copies of the primary key of each table in the relationship.
Structure of the new table is form with the use of these primary keys.
As shown in following figure, there is no relation between Teacher and Student entities. To
implement many-to-many relationship, third table teaching is being created with primary
keys from both the tables
3.6.4 Unary or Recursive Relationships
Search WWH ::




Custom Search