Skip to main content

Link Retool Database tables

Learn how to link tables in Retool Database.

You can link rows between tables in the Database editor UI to see relevant data in one place. For example, you could link a table with customer information to another table with subscriptions.

The Foreign Key field references a field from another table that contains unique values, such as the primary key. Once a value is set, you can view the relevant linked row.

Add a Foreign Key field

To add a foreign key field to a table:

  1. Click Add Add to the right of the last field.
  2. Select Foreign key as the field type.
  3. Specify the table and field on which to link. For example, the id field of a subscriptions table. You can only select fields with unique values.
  4. Set a value in the new field that corresponds to a value of the field you selected. For example, a subscription ID.

View linked table data

Once linked, you can click View foreign key row View foreign key row within the cell to open the referenced row. You can then edit the referenced table data directly without needing to switch to another table.

The values you specify for foreign keys do not need to be unique. You can link to the same unique row on the linked table multiple times (e.g., multiple orders for the same customer).