F
F
FrolVII2021-12-11 00:46:56
Database design
FrolVII, 2021-12-11 00:46:56

How to form a table of initial relations when designing a database?

At the moment I'm trying to figure out the issue of designing databases (hereinafter referred to as the database). I read the section of the same name from the textbook Homonenko A.D., Tsygankov V.M., Maltsev M.G. "Databases. A textbook for universities" (hereinafter referred to as the Textbook).
At first glance, everything is clear. Database design begins with the definition of attributes, bringing them into a single table of initial relations, then we deal with the decomposition of this table.
I tried to set and solve a similar problem on my own. So, let's make a table of initial relations... And already here I started having difficulties. Everything was clear with the table given in the Tutorial, but in practice I suddenly had a need to make data from different rows of this table dependent on each other. I think it will be easier to explain with an example.
Let there be a table of workers and the work they perform. Some jobs can only be done after the previous ones are finished:

Worker ---
Octavian's job --- Claudius builds walls
--- Hangs pictures

Claudius can hang a picture on the wall only after Octavian builds it How to reflect this ratio in the original table? Break down the work into stages? Something like this:

Worker --- Stage 1 work --- Stage 2 work
Octavian --- Erects walls ---
Claudius is resting --- Resting --- Hanging paintings

Assign an additional attribute of a certain "weight" to the works, from which the sequence will follow their implementation?

Worker --- Work --- Work weight
Octavian --- Build walls --- 1
Claudius --- Hanging pictures --- 2

Or create two different tables of initial relations at once, decompose them separately, and then somehow link the result?
Or maybe I immediately went down the wrong path and I needed to somehow highlight the attributes for the source relationship table?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
Konstantin Tsvetkov, 2021-12-11
@tsklab

When designing a structure, it is better to go from the physical model of the subject area to the maximum abstraction. Having received the main peaks, go back to detailing, trying not to produce similar entities.
In your example, the vertices are: "Worker", "Task". A "Task" consists of "Stages". "Stage" from "Work" (she only appears here). It is for the performance of this "Work" that "Workers" are recruited. Moreover, the "Job" does not have a direct connection with the "Employee", since the "Job" must have a "List of execution" from the "Types of work", to which specific performers are already connected (namely, in the plural).

S
Slava Rozhnev, 2021-12-11
@rozhnev

Here you have at least 3 tables:
1st Workers:
Octavian,
Claudius,
August
2nd Types of work:
Building walls,
Hanging pictures,
Managing the process
3rd linking Stages of work:
1st stage Octavian - working
1st stage August - in charge
of the 2nd stage Claudius - in operation
of the 2nd stage August - in charge

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question