English

How To: Create a many-to-many relationship in a geodatabase

Summary

Instructions provided describe an example of how to create a many-to-many relationship class in ArcGIS.

Additional information on relationship classes can be found in the book 'Modeling Our World', Chapter 3, in the section entitled 'Vector modeling with features', p. 78-85.

Another resource is Desktop Help, installed with ArcGIS, and also available online. In the Table of Contents, navigate to the section Professional Library > Data Management > Geographic data types > Relationships and related objects.

Procedure

The following is an example of creating a many-to-many relationship between a parcel feature class and a table of parcel owners.

  1. In ArcCatalog, create a new file or personal geodatabase.
  2. Create a new polygon feature class in the geodatabase called Parcels. Add a column called Pin, which is a key field for this feature class.
  3. Create a new stand-alone table in the geodatabase called Owners. Add a column called Owner_Id which is the key field for this table.
  4. Create the relationship class between the Parcels feature class and the Owners table. The following image lists the parameters to be used, and shows how the final summary dialog should appear.
    [O-Image] Summary dialog for relatationship class
  5. Start ArcMap and add the Parcels, Owners, and ParcelToOwners datasets to the display.
  6. Start an edit session and add several polygon features to Parcels and add several records to the Owners table. Make sure to populate the key fields in Parcels (Pin) and Owners (Owner_Id). Save the edits.

    Records cannot be added directly to the ParcelsToOwners table. The remaining steps explain the procedure for adding records to this intermediate table.
  7. Select one feature from Parcels and one record from the Owners table. Multiple selections can be made by holding down the Shift key while selecting.
  8. On the Editor toolbar, click the Attributes button to open the Attributes dialog box. Double-click the feature Object_Id number in the attributes dialog to see the 'is owned by' label.

  9. Right-click the 'is owned by' label and select Add Selected from the context menu.
    [O-Image] Add Selected Dialog
    Keep the Owners table open when editing so the Add Selected option is enabled.
  10. Open the ParcelsToOwners table. New records are added to the intermediate table containing the key values from the Parcels and Owners objects. Close this table after viewing the relationship.
  11. Select another feature from Parcels and several records from the Owners table. Repeat steps 8 through 10 to add several new records to the intermediate table.

    Note:
    When a stand-alone table listing the many-to-many relationships already exists, a tool in ArcToolbox can be used to automate the creation of the relationship table. The tool is found under Data Management Tools > Relationship Classes > Table To Relationship Class.

Related Information