Connection Fields
Transcript Summary
Introduction
What's up, Databasers? Sam here, and today I'm going to teach you all about connections. Connections are one of the most important things when it comes to Tadabase and databases in general.
Here's what you're going to learn:
- What connections are.
- How to make connections.
- Why you would use connections.
- The benefits of connections.
Example: Companies, Contacts, and Notes
Let's say I have a database with a table storing a list of companies I service, and at those companies, I have contacts. For each contact, I store different notes. I have a table for companies, a table for contacts, and a table for notes.
Now, I want to connect the companies to the contacts to show which contact works at which company. Additionally, I want to show all relevant information about the company, such as the address and phone number, when viewing a contact. I also want to connect notes to the contacts so I can store multiple notes about each contact. This setup allows me to relate multiple notes to each contact.
Why Use Connections?
The reason we don't simply create a field called "notes" in the contacts table is that it would limit us to only one note per contact. By creating a connection between the notes and the contacts, we can store multiple notes for each contact. Each note is connected to a specific contact, which allows for flexible data management.
Related Tables
The company's table is connected to the contacts table, and the contacts table is connected to the notes table. The notes table is indirectly related to the companies table via the contacts table. This is called a related table, and it allows you to pull information from the companies table when viewing notes, even though there is no direct connection.
The Importance of Connections vs. Manual Data Entry
If you didn't have connections, you would have to manually enter the company information for each contact. This means that if a company’s information changes, like the name or address, you’d have to update it manually for every contact. With connections, you update the information once in the companies table, and it automatically updates for all related contacts.
Demonstrating Connections in Tadabase
In Tadabase, creating connections is simple. In the data builder, you go to the fields section of your table and add a new field called "connection." You then choose which table to connect to, such as connecting the contacts table to the companies table. Once the connection is made, you can display any information from the connected table, such as the company name or address, within the contacts table.
Setting Up Connections
To create a connection:
- Decide which table comes first (the parent table) and which table is secondary (the child table). For example, companies are the parent, and contacts are the child.
- Connections are made from the child to the parent table.
- Add a connection field in the child table, such as connecting contacts to companies. You can then display fields from the connected table, such as the company name, in the contacts table.
Viewing and Using Connected Data
Once you’ve set up the connection, you can display data from the parent table within the child table. For example, in a contacts table, you can display the company name, address, or any other field from the companies table. You can also display data from connected tables in the front-end application, allowing users to see information from multiple tables in one place.
Conclusion
Connections are a powerful feature in Tadabase that allow you to efficiently manage related data across different tables. By setting up connections, you can avoid manual data entry, ensure data consistency, and easily display relevant information from related tables.
I hope this gave you a clear understanding of how to use connections in Tadabase and the benefits they bring. Thanks for watching!
We'd love to hear your feedback.