A
A
Andrey Lyubimenko2019-11-30 17:17:35
MySQL
Andrey Lyubimenko, 2019-11-30 17:17:35

Have I organized the relationships in the tables correctly?

The java application will work with the mySQL DBMS, the task is as follows:
There is a "park" system. In it, I create an Owner (this is a common Human table for all people) who gives the task to the Forester (about planting, treatment, artistic processing, destruction) Plants (Plant) . There is a table Role (Role) in which I add roles for people (from the human table). Who is the owner and who is the forester, etc. is determined by the role field.
5de277135d51e249761043.png
I sketched several tables, and my problem is that I don’t know how best to store the task, create a table with the task (instruction)? And store in it from whom, to whom and with what plant is it connected? And whether it is correct, what so broke tables?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
Gennady Kruglov, 2019-11-30
@andrewlybimenko

1. At the moment, you only have a case in your database when one human can have only one role. In real life, as a rule, one human can have several roles, so a one-to-many relationship would be more suitable here. Although, if the task does not have such strict requirements and suits you yourself, then ok, maybe it will do.
2. You probably still need some table-dictionary of actions (disembarkation, treatment, etc.).
And replace the instruction table with an index table, which will store the link - human + action + plant.
Something like this.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question