Creating Many to Many Relationships


You are recommended to read "Understanding Relationships" before this section if you haven't already.

Recommended video: Creating Relationships

How to Create Many to Many Relationship

  1. Click "Design" from main menu, select "Relationships".
  2. The relationship management window will open. Click "New Relationship" button.
  3. Select the first catalog you wish to create a new relationship for.
  4. Select the relationship type as "Many to Many Relationship".
  5. Select the second catalog.
Review the displayed information carefully to make sure that the suggested relationship properties reflect what you want to do.
Note that a Many to Many relationship is symmetric, that means each catalog is each other's "parent" as well as "child". Interchanging the catalog names would produce exactly the same result.





The example given in the picture above shows a Many to Many relationship between Teacher and Student catalogs. Each teacher has many related students. Each student also has many related teachers as they may have more than one teacher. When you open a teacher record, you may display a list of all related students by clicking a menu button. The same is also true for student records. A 1 to Many relationship alone would not serve this purpose.

Menu Name: The administrative name of the relational records. This name is not shown on record window but used to easily identify the relationship whenever you modify or review the database design. You are recommended to keep the recommended naming convention.
Display Name: The displayed title of the menu button which is shown on left side of the record window.

You may change both menu name and display name any time you want.

DESIGN TIPS:

Displaying Relational Data on Record Windows

When you create a Many to Many relationship, a menu button is automatically added to record windows of both of the catalogs. Clicking those buttons will display the related records from the parent catalog. You will also be able to either create new or add an existing record to the related record list.
It is possible to create dedicated views for related record lists. See Menu Designer for more information.

Modifying a Relationship

Once created, changing the relationship type (1 to N or N to N) or changing any of the catalogs is not allowed. If you need to change these, you should consider deleting the existing relationship first which will also remove all the related data information from records.

You may at any time rename menu button titles.

Deleting Relationships

Deleting a relationship deletes both of the relationship menu buttons on record windows of each catalog. No records are deleted from your database however, you will lose the "related data" information from all records on both catalogs.





Online Help Home Page   ::   SpeedBase Software Home Page