Querious Help 5

Relationships

Following foreign keys from the selected row to related rows in other tables.

The Relationships panel in the Table Content view's right sidebar is the handiest way to navigate between tables by their actual relationships to each other.

The Relationships panel lists the tables related to the current table by foreign keys. Clicking one of these tables will jump to the rows there, that are related to the selected row in the row list. Use it to explore a schema by its data: from an order to its line items, from a line item to its product, and so on.

To show it: use the Sidebar toolbar button or EditorToggle Sidebar, then turn on the Relationships panel with the sidebar's panel buttons. It can be shown alongside other panels in the sidebar.

Example #

In this example database, here are some tables with foreign keys:

Table Has an FK pointing to…
orders customers, addresses, promo_codes
order_items orders, games, dlc...
refunds orders
support_tickets customers, orders

Notice in this screenshot that the Relationships panel displays tables related to currently selected row in the Table Content row list.

An order selected in the orders table, with its related tables listed in the sidebar

What It Lists #

The list is alphabetical, and an icon beside each table shows how it's related:

Icon Destination is a… Jumps to…
Parent. The current table has an FK pointing to the parent. The parent row pointed to by the current row. Ex: orders → customers
Child. The current table's row is pointed to by an FK in the child. The rows that points to the current row. Ex: customers → orders
Ancestor. A ancestor (through the parent), up to three hops away. The row reached by following the chain. For example, order_items → orders → customers. Jump to the customer from a line item.
Sibling. It shares a parent with this table. The rows in the sibling table that reference the same parent. Ex: All reviews left by the current order's customer.

If the current table has two foreign key columns which both point to the same destination table, the Relationships panel will show each foreign key's name explicitly so you can tell them apart.

Choosing Which Relationships to Show #

The Include menu in the list's header chooses how far the list reaches:

Option Shows
Direct Relations Only Parents and children. Short and to the point.
Include Ancestors Also ancestors and siblings. Use it to skip intermediate tables, such as going straight from an order to its customer's country, or to its customer's reviews.
The orders table's relationships with ancestors and siblings included

The choice is remembered. When a table has 15 or more relationships, a filter field automatically appears above the list to narrow it by table name.

The Selected Row #

Select exactly one row to see the relationships and jump.

The list in the Relationships panel depends only on the current table's foreign key columns, but a jump uses the values in the selected row. With zero, or more than one row selected, the list is dimmed and does nothing.