The 'Data Source' field type connects database tables by defining relationships between them. This field type enables users to build databases with the following features:
Referential Integrity:
The 'Data Source' field ensures that the data in one table (referred to as the child table) corresponds to the data in another table (referred to as the parent table). They define a relationship between the two tables based on a shared column or columns. The 'Data Source' field in the child table references the primary key in the parent table, establishing a link between the two.
Data Consistency:
The 'Data Source' field helps maintain data consistency by preventing orphaned or invalid data. With referential integrity enforced by the 'Data Source' field, you cannot insert a value into the child table's 'Data Source' column that does not exist as a primary key in the parent table. This constraint ensures that data in the child table remains linked to valid and existing data in the parent table.
Joins and Data Retrieval:
The 'Data Source' field enables efficient data retrieval and querying through joins. Joins allow you to combine data from multiple related tables based on the 'Data Source' and primary key relationships. By joining tables, you can retrieve related data and perform complex queries involving data from multiple tables.
Cascading Actions:
The 'Data Source' field can also define cascading actions that automatically propagate changes across related tables. For example, you can specify actions such as cascading deletes or updates, where modifying or deleting a row in the parent table automatically affects the corresponding rows in the child table.
Before we proceed with creating a 'Data Source' field, note that there are two 'Data Source' field types:
To connect database tables using the 'Data Source' field, follow the steps outlined below:
The field requirements and descriptions for adding a 'Data Source' field are displayed in the following table:
Input Label | Type | Required | Description |
---|---|---|---|
Field Name | Input Field | Yes | The name or label of your 'Data Source' field. |
Field Type | Dropdown Field | Yes | Type of field. |
UI Element | Dropdown Field | Yes | UI element used by the 'Data Source' field. In this case, only 'Select' is available. |
Data Source | Dropdown Field | Yes | Database that the 'Data Source' field references. |
Display Field | Dropdown Field | Yes | The field in the source database whose data is displayed by the 'Data Source' field. This field allows you to display on the table data you are linking to other than the data source you are using to link to the said table. For example, you can display a user's name from the 'Users' table even though the connection is made via the 'user_ID' field. |
Mandatory | Toggle | No | Use the toggle to indicate whether the field is required for users to fill out or not. |
The field requirements and descriptions for adding a 'Data Source (Multiple)' field are displayed in the following table:
Input Label | Type | Required | Description |
---|---|---|---|
Field Name | Input Field | Yes | The name or label of your 'Data Source' field. |
Field Type | Dropdown Field | Yes | Type of field. |
UI Element | Dropdown Field | Yes | UI element used by the 'Data Source' field. In this case, only 'Select (Multiple)' is available. |
Data Source | Dropdown Field | Yes | Database that the 'Data Source' field references. |
Display Field | Dropdown Field | Yes | The field in the source database whose data is displayed by the 'Data Source' field. This field allows you to display on the table data you are linking to other than the data source you are using to link to the said table. For example, you can display a user's name from the 'Users' table even though the connection is made via the 'user_ID' field. |
Mandatory | Toggle | No | Use the toggle to indicate whether the field is required for users to fill out or not. |
Let's use two tables called
No orders can enter the system without a valid user being associated with them. The referential integrity and data consistency afforded by linking databases enable multiple users to place orders, check their status, and retrieve their order histories simultaneously. While this happens, other users can also update or cancel their orders as desired.
table_customer
CustomerID | Customer Name | Phone | |
---|---|---|---|
561423 | John | john@example.com | +61 456 687 6779 |
561677 | Katy | katy@example.com | +61 393 210 9879 |
561789 | Jerry | jerry@example.com | +61 411 237 2192 |
561867 | Mary | mary@example.com | +27 782 876 7794 |
table_orders
OrderID | CustomerID | Make | Model | Colour |
---|---|---|---|---|
51145 | 561423 | BMW | M3 | White |
51176 | 561867 | Mazda | RX7 | Black |
51335 | 561423 | Lamborghini | Aventador | Blue |
51476 | 561677 | Porsche | 911 | Green |
In this example,
Didn't quite find what you are looking for or have feedback on how we can make the content better then we would love to hear from you. Please provide us feedback and we will get back to you shortly.