Create a simple relationship class

You can create relationship classes between any feature class or table in a geodatabase using the Create Relationship Class or Table to Relationship Class geoprocessing tools in ArcGIS Pro. You can use these tools to create simple, composite, and attributed relationship classes.

A simple relationship class, is defined between two tables, where one is the origin and the other is the destination. The relationship is based on a common attribute field in the origin and destination tables. The relationship between the origin and destination tables is maintained as long as the common attribute field values match. The deletion of a feature or row in the origin table does not affect the related features or rows in the destination table. However, when a feature or row in the origin table is deleted, the foreign key value for the related features or rows in the destination table will be set to Null, ensuring referential integrity. This foreign key value can be updated to form a new relationship with a different origin feature.

For example, in a law enforcement system, a one-to-many relationship exists between police stations (origin) and officers (destination). Each station houses multiple officers, but each officer is assigned to only one station. If a station is demolished, the officers can be reassigned to a different station, creating a new relationship.

Before getting started with the steps below, see Prepare to create a relationship class to review the data requirements. .

Note:

Relationship classes are supported in file, mobile, and enterprise geodatabases. To create a relationship class, you can right-click an existing geodatabase or a feature dataset in a geodatabase. If you're creating a relationship class in an enterprise geodatabase, you must connect to the enterprise geodatabase as a user with privileges to create data in the database.

To create a simple relationship class, complete the following steps:

  1. Start ArcGIS Pro and open an existing project, or begin without a template.
  2. In the Catalog pane, right-click an existing geodatabase and click New from the context menu.

    Context menu of options for creating new objects

  3. Click Relationship Class Relationship.

    Relationship Class option

    The Create Relationship Class geoprocessing tool dialog box appears with default settings.

    Create Relationship Class geoprocessing tool

  4. For the Origin Table parameter, you can choose a dataset from the list, or use the browse button to find a dataset.

    Origin Table parameter

  5. For the Destination Table parameter, you can choose a dataset from the list, or use the browse button to select the dataset.

    Destination Table parameter

  6. For the Output Relationship Class parameter, click the browse button Browse, browse to the geodatabase where the relationship class will be stored, provide a name for the relationship class in the Name text box, and click Save.

    For this example, the origin and destination tables are located in a mobile geodatabase named Wyoming Natural Assets.geodatabase. The relationship class must also reside in this mobile geodatabase. Since the mobile geodatabase is built on top of SQLite, the main prefix is automatically added to the relationship class name to indicate that it belongs to the main schema, which is the default schema for a SQLitedatabase.

    Naming the output relationship class

    The name of the relationship class is reflected in the Output Relationship Class parameter.

    Populated Output Relationship Class parameter

  7. For the Relationship Type parameter, choose Simple from the drop-down list.

    Relationship Type parameter set to Simple

    To learn more about the differences between the simple and composite relationship class types, see Geodatabase relationship class types.

  8. Provide values for the Forward Path Label and Backward Path label parameters.

    Forward Path Label and Backward Path label parameters

    The forward path label describes the relationship as it is navigated from the origin class to the destination class, and the backward path label describes the relationship when navigated in the opposite direction, from the destination class to the origin. See Create Relationship Class tool parameters to learn more about these labels.

  9. Since you are creating a simple relationship class, for the Message Direction parameter, choose None (no messages propagated).

    The Message Direction parameter specifies how messages are passed between related objects. See Create Relationship Class tool parameters to learn more about setting the Message Direction parameter for a relationship class.

  10. For the Cardinality parameter, choose the cardinality option that is appropriate for the data in the relationship class.

    Cardinality parameter set to One to one

    The cardinality for a relationship class describes how many objects in the origin are related to how many objects in the destination. The following are the Cardinality parameter options:

    • One to one (1:1)—Each row or feature in the origin table can be related to zero or one row or feature in the destination table. This is the default setting.
    • One to many (1:M)—Each row or feature in the origin table can be related to one or more rows or features in the destination table.
    • Many to many (M:N)—Multiple rows or features in the origin table can be related to multiple rows or features in the destination table.
    See Create Relationship Class tool parameters to learn more about cardinality.

  11. Optionally, check the Relationship class is attributed parameter (or leave it unchecked) to specify whether the relationship class will have attributes.
    • Unchecked—The relationship class will not have attributes. This is the default.
    • Checked—An attributed relationship class will be created. When a many to many (M:N) or attributed relationship class is created, a new intermediate relationship class table is created. This table is used to map the associations between the origin and destination objects. See Geodatabase relationship class types to learn more about attributed relationship classes.
  12. For the Origin Primary Key and Origin Foreign Key parameters, specify a field from the origin table and a field from the destination table, respectively.

    The Origin Primary Key and Origin Foreign Key parameters specify the primary key in the origin feature class and the associated foreign key field in the destination table. For the Origin Foreign Key parameter, only the fields that are the same data type as the field specified for the Origin Primary Key parameter are displayed.

    Create Relationship Class tool parameters populated for a simple relationship class

  13. Click Run to create the relationship class.

    Note:

    You can click the Run drop-down menu and click Schedule Run to run the tool at a later date and time and, optionally, with recurrence.

    Schedule Run option

    Learn more about scheduling geoprocessing tools

Related topics