One-to-one communication (1: 1) - Databases: design

One-to-one-to-one (1: 1) connection

A type of one-to-one communication is used when it is necessary to separate a set of information uniquely associated with a particular instance of the original structural element. So, for example, if there is a need to separate the passport data into a separate structural element in order to ensure the delineation of access rights to the relevant information, then the "Passport data" element and Employee a one-to-one relationship will be established.

One-to-one relationship (1: 1) refers to an interaction of structural elements in which one instance of one element can be associated with no more than one instance of another element.

It is very important to correctly interpret the relevant structural elements and the relationships between them. Considering the relationship between the Passport data and "Employee", you need to ask: "Do I need to store the passport data in the database if the employee has changed the passport, or the passport data must be replaced?"

Table 2.11

Example of data, according to passport data, employees

No. п/п

Employee

Passport data

1

Ivanov I.P.

Series: 45 01 No. 657954, issued by the Internal Affairs Directorate "Vykhino" 01/25/2002

2

Skvoryga A.I.

Series: 43 02 No. 324891, issued to the Mitino police department " 05/15/1999

...

...

Correct evaluation of possible values ​​for relationships between structural elements is the key to further database design. The analysis of the subject area in this example showed that each employee is assigned only one variant of passport data. The ego is evident from the structure of Table. 2.11 with the domain data. This table shows that each employee is only presented once and each is presented with passport data that is also not duplicated.

The peculiarities of the subject area associated with passport data point to the fact that each passport is unique and the totality of its information is found only once and only for one person (employee). In this case, the collection of a series and numbers can be considered a set of attributes, which constitute a unique combination of values ​​for each passport. You can, of course, analyze all the data on passport data in the document "Personal Leaflet" of each employee of the organization, but this can be quite problematic because of the large amount of data analyzed or the confidentiality of information. It is these factors that require the developer to have a good knowledge of the subject area and the specifics of working with certain data. But even knowledge about the subject area will not answer the question posed about the possibility of having several passport data from one employee. It is important to have information from the organization's employees obtained in the process of analyzing the subject area and activities in the organization.

As the answer in the given variant is the fact that each employee will be described in the database only by one set of information about the passport data, then we can say that:

• for one employee only one passport will be kept (this is determined by the peculiarities of storing information on employees in the organization in question);

• One passport will identify only one employee (this is determined by the peculiarities of working with passport data in the subject area).

Finally, for the example in question, the relationship between the structural elements Employee and Passport data can be represented as in Figure 2.38.

In the future, when analyzing the connection at the time the database model is being formed, the developer will determine the additional components: the connection's meaning, the number of links of the structural elements (power, cardinality), the ability to store the empty value, etc.

< center>

thematic pictures

Ошибка в функции вывода объектов.