A One-to-One relationship between two tables refers to a link between a single record in each table. These types of relationships are common when a Parent Table links to a Lookup Table or another Parent table for a reference. The nature of this relationship, as the name implies, is that a single record in the relating table is linked to a single record in the related table. Examples of One-to-One relationships include:
- A record in a Company Employee table linked to a record in the Company Departments table to indicate where the employee is assigned to work
- A record in the Customer Table linked to a record in the Sales Team table to indicate which salesperson is assigned to which customer
- A record in the Patients table linked to a record in the Physicians table to indicate which care provider takes care of which patient
The One-to-One relationship between a relating table and a related table is demonstrated in the image below.
In Ninox, One-to-One relationships are represented by an arrow that originates at the relating table and concludes – with the arrow head pointing to – the related table. The best way to understand this type of table relationship is to image the relating table needing information and the related table providing information. In this sense, the relating table is asking a question and reaching out to the related table in order to get the answer. With regards to the three examples above, in question 1, the Employee is asking “where am I assigned to work?” with the answer lying in the Departments table. In question 2 the customer asking “who is my salesperson?” with the answer lying in the Sales Team table. And in question 3, the patient is asking “who is my primary doctor?” with the answer lying in the Physicians table.
For additional information on creating One-to-One relationships, please refer to the How to Build Parent-to-Parent Table Links of this users manual.