Link records between tables in Retool Database
You can link records between tables in the Database editor UI to see relevant data in one place. For example, you could link a table with order information to another table with user details. The foreign keys 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 record.
- Click the + button to the right of the last field and select Foreign key as the field type.
- Specify the table and field on which to link. You can only select fields with unique values.
- Set a value in the new field that corresponds to a value of the field you selected.
Once linked, you can click the Link icon to jump to the related record.
The values you specify for a Foreign key field do not need to be unique. You can link to the same unique record on the linked table multiple times (e.g., multiple orders for the same customer).