Relations

Records from different tables can be connected with each other; TeamDesk allows users to establish relationships between records in one table and records in another table.

The system supports two main types of relationships between records: one-to-many relationships and many-to-many relationships.

One-to-Many Relationship

Let’s assume that in your database, you’ve created two tables. The first is called "Projects," which contains information about various projects. The second is "Clients," where clients’ profiles are stored.

Every project is ordered by a client, and some clients may order multiple projects. However, each project can be related to only one client.

To link "Projects" and "Clients," you need to create a relationship between these tables. Records are related by their key column values, and by default, the Id column is set as the key column.

This relationship allows the selection of a client record (Client Id value) for each project record (Project Id value). As a result, clients’ names will be displayed in the "Projects" table.

One-to-Many Relationship

What is the Id column, and where does it come from?

TeamDesk requires each record in the table to have a unique identifier. In some designs, a record can be identified by a specific code, such as an ISBN number for a book or a stock ticker for a company.

In our case, using the client name for identification isn’t practical, so TeamDesk assigns incremental numbers to the records. The Id column is created with every table and is used as the default key.

Many-to-Many Relationship

For example, consider three tables: "Designers," "Hours Worked," and "Monthly Payments."

The "Designers" table stores profiles of designers, the "Hours Worked" table logs the hours worked by each designer, and the "Monthly Payments" table stores designers’ hourly rates for each month.

In this case, you can create a Many-to-Many relationship between the "Hours Worked" table and the "Monthly Payments" table. This allows for the calculation of a summary column that shows the total hours worked during each month by every designer in the "Monthly Payments" table.

Many-to-Many Relationship