Database Programming

What is one to one database relationships?


Wiki User

This is where you have two tables and each record on one table has one and only one corresponding record on the other. To connect them, they both have a corresponding code, that is unique in each table. So you could have a database for employees. In a table in it you could have all their personal details. On another you could have their salary details. On both tables, for each individual there would be a unique code, like an employee code. When a particular employee is found on the employee table, their code is taken and checked for on the salary table to find the details for their salary. It is then not necessary to have their name in both tables, as the code can be used to link the two parts of their data together from the two tables. The code is the only thing that will be in both tables. As every code on one table has one corresponding code on the other it is a one to one relationship. There are other types of database relationships, namely one to many and many to many.