A
A
Alksar2015-04-30 11:48:26
MySQL
Alksar, 2015-04-30 11:48:26

Duplicate in the database. How to win?

1a8da2da9dcc4c628f19421166cbd786.png
Duplication attacked, apparently due to incorrect design.
Comments on the scheme:
- services (Service) are linked to the order (Order) using the table (Order_Service)
- each order service (Order_Service) is performed by an employee, connection: table (Employee_Order_Service)
- services are presented in two types:
+ translation (TranslationInfo), stores the name of the text being translated, the languages ​​from which and into which the translation is being made (LangFrom, LangTo)
+ the certification of the translation (NotarialInfo), also stores the name of the text, languages, number of copies of the certification.
But here is such a flaw ... Such a problem, look, the type of service "translation" and "certification" contain many identical fields, namely: file name, language 'from', language 'to'. Therefore, if you change, for example, the name of the text, you will need to change it in both TranslationInfo and NotarialInfo. Only texts that have been translated can be certified, so it would be better to place the "CopyCount" field in the "TranslationInfo" table, and not create the "Notarial" table at all! But the assurance must have its own executor, its own price. The translation also, respectively, has its own performer and price.
How to be? How to fix?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
Kirill Penzin, 2015-04-30
@Alksar

Create two related fields: Employe_translation_id, Employe_notarial_id, for example. Combine the rest. And put triggers on whether the document is translated, if so, is it certified?
UPD: Let's say you have a one-to-many relationship from ServiceInfo to OrderService. When notarizing, you simply add another record from Order_Service to the association and fill in the CopyCount field. Thus, the presence of a value in the CopyCount field and a relationship with two records from Order_service (Two IDs in the Order_Service_id field) will be a condition for determining the certification of this document.

M
Maxim Grechushnikov, 2015-04-30
@maxyc_webber

The question was not fully addressed.
Can triggers help? Behaviors?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question