A
A
Antigo_ptz2016-12-05 12:19:02
SQL
Antigo_ptz, 2016-12-05 12:19:02

How to substitute old reference values ​​in the database?

Greetings!
Let's say I have in the database the entity worker (employee) and institution (educational institution). Each employee has a record of the educational institution in which he studied, i.e. one-to-many relationship between tables.
Suppose once an educational institution was called KSPU and was chosen from some workers. Then the educational institution was renamed into KSPA. The question is, how can I make old records so that the old name of the educational institution (ie KSPU) is stored there? What are some thoughts? Well, for new employees, of course, new values ​​are chosen.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey Skorzhinsky, 2016-12-05
@AndyKorg

Can it be like this
876cb10617f7471d9c4facdcad318a9e.JPG

M
Melkij, 2016-12-05
@melkij

For starters, there is a many-to-many relationship between the employee and the school.
Secondly, why are only new values ​​selected for new employees? It is possible to be at the same time a new worker and graduate some twenty years ago from the former educational institution. You can choose from the entire list, or, which is better, store the opening year and closing year for the institution (default null) and select the appropriate years of study.
If you also save the dates of study, then it is important to consider that the educational institution can be closed at any time between admission and graduation of a student. He entered one institution, graduated from another - easily.
If there are no special requirements for finding educational institutions, then it is enough to store the year of closing (default null) and a link to the new form after the reorganization, if any (therefore also default null).
For your example, there will be KGPU for example with edu_id = 105, reorg_to_id null and KGPU with its own edu_id, closing date and reorg_to_id = 105

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question