Recommended video: Creating Relationships
A relationship is defined between two catalogs. It helps to easily access the related information stored in the
second catalog while you are viewing a record details of the first catalog. Creating relationships (whenever
possible) greatly enhances the performance and ease of information management in your working environment.
SpeedBase supports creating both one to multiple (1-N or N-1) and multiple to multiple (N-N) type relationships between catalogs.
In real world applications, various types of information frequently have some relationship between each other.
Note that creating a relationship field actually creates two fields, one for the first and the other for the second catalog!
A Real World Example
Suppose that you store company information you store in a "companies" catalog.
Suppose that you also store contact information in a "people" catalog. Somehow, you need to link certain people
with a certain company they work for. Whenever you view a company information, you also need to view the list
and easily access the details of workers of that company.
On the opposite side, if you are viewing details of a worker, you need to easily view and access the company details
he/she is working for. It would be waste of time if you had to enter/update the same company information for all of
its workers again.
Relationships make it possible to jump from a record you are viewing to another type of record related to the former
with a single click. Starting from a company record, you may jump to products of that company, or to the contact details
of the manager of it, or to the list of the orders you received from it, or to the phone calls or support activities of it etc…
Types of Relationships
There are basically two types of relationships.
1 to Multiple (1 to N or N to 1) Relationships
Suppose that you wish to create a relationhip between Customers and Phone Calls. Suppose that
you have distinct records for all of your customers and you also create distinct record for every call you receive.
It is evident that a certain phone call record may only be related to a single customer. However, if you look from
the customer side, a customer may be related to an unlimited number of phone call records.
1 Customer is related to many Phone Calls. So, we call this as 1 to Multiple Relationship between Customers and Phone Calls.
Note that, 1 to N and N to 1 relationships are actually the same thing. So,
We may also call this as Multiple to 1 Relationship between Phone Calls and Customers.
If you create a field of type 1 to N relationship for CATALOG A with a target CATALOG B,
SpeedBase will automatically create a field of type N to 1 relationship for CATALOG B with a target CATALOG A
See "Creating 1 to Multiple Relationships" to learn how to create this type of relationship.
Multiple to Multiple (N to N) Relationships
Suppose that you wish to create a relationhip between Students and Teachers.
Suppose that you have distinct records for all students and all teachers. In most scenarios, every student
takes multiple courses from multiple teachers. Every teacher also teaches to many students.
So every student is related to many teacher as well as every teacher is related to many students.
In this case, we have a multiple to multiple relationship.
You may think that you can simply forget about other types and create N to N in every case as it already covers the rest.
However, an N to N type relationship is not convenient as you cannot get the list of students with related teacher information
in a single table. This is due to fact that each row of student has multiple teacher relations which cannot be displayed in a
single "teacher" column.
You are recommended to prefere 1 to N (or N to 1) type relationships if there is no (or almost no)
actual need for creating N to N relationship.
See "Creating Multiple to Multiple Relationships" to learn how to create this type of relationship.