Quick DefinitionDatabase relationships show how different tables of data connect to each other - like how a customerโs ID links their personal information to their complete order history. These relationships can be one-to-one (one person, one social security number), one-to-many (one customer, many orders), or many-to-many (many students can take many classes).
๐งโ๐คโ๐ง Types of Relationships
In Xano, there are three primary ways tables can be related:1. One-to-One
This is like a person and their unique passport. Each data entry in one table relates to exactly one entry in another table.2. One-to-Many
Think of a parent and their children. A single entry in one table can relate to multiple entries in another. For example, one teacher can teach many students.3. Many-to-Many
Similar to students enrolling in various courses, any entry in one table can relate to multiple entries in another.โ Why Use Relationships?
- Data Consistency: Ensures all references are valid.
- Reduced Redundancy: Minimizes repeated data.
- Efficient Data Retrieval: Makes it easier to access related data.
๐ Using the Table Reference Field Type
When you add a table reference field to a database table, that field simply stores the IDs of the record(s) being referenced; the data is not actually duplicated. To access the actual data is typically done via an add-on as part of a function stack.Auto-Complete
Auto-Complete allows you to configure how the referenced records look inside of other tables. For this example, we have two tables:user
and userRole


1
Navigate to the table you are referencing data from to adjust the Auto-Complete settings.
2
Click the โฎ icon and choose Auto-Complete
3
Click 'Customize' if this is your first time enabling Auto-Complete customization on this table.
4
Click 'Add Column' to add a new field that will appear on tables that reference this one.