Database Relationships

Xano makes it easy to visualize and select relationships of your database tables.

In Xano, a relationship between database tables is created using the data type table reference.

Relationship data display A table reference is typically just an integer referencing the unique ID number from the table of the referenced record. However, often times it's helpful to visualize what the reference represents beyond just a ID. With Xano, you can see the fields of your referenced record that are important to your use case.

In this example, we are viewing the deals table. Each deal has a relationship to a merchant record, as signified by the merchant_id field. Each field is displaying data from the merchant table including the name, description, and id of each merchant record.

Auto-complete relationships When entering a reference record, Xano presents you with a drop-down menu. The menu provides you with the recently added records from the table you are referencing. Additionally, there is a search bar where you can search for the id number or any of the displayed field values. You can quickly navigate using the keyboard arrows and enter key.

In this example, the current value is Firestone BBQ #1. There is an auto-generated list of the most recently added records from the merchant table. Additionally, we can search for any of the displayed fields and the record id #.

Choosing which data to display By default, Xano will automatically display the first text field and the id field of the referenced table record. However, you can easily customize which data you'd like to be displayed in your table reference.

In the parent table (or the table being referenced), click the menu icon in the top right (three dots), then select Auto-Complete. In this example, the parent table or table being referenced would be the merchant table.

In this example, select Auto-Complete in the merchant table to customize which data is to be displayed in other tables referencing the merchant table.

After selecting Auto-Complete, the settings will open up. Click customize in order to customize the display of the referenced data.

Once the Auto-Complete settings open, click Customize to customize the layout of the display.

You can add multiple columns, reorder the columns displayed, and remove columns from the display.

In this example, the displayed columns are name, description, and id - in that order.

​