M
M
mars1302019-11-07 19:27:36
Database design
mars130, 2019-11-07 19:27:36

How to generate a working calendar of specialists in SQL?

There is a table master_list which contains a registry of masters with their id, first name, last name and status working, not working.
I want to make a work schedule for the masters so that when a person signs up and chooses a date and time, only those masters who work according to the schedule on the selected day are shown to him.
I'm thinking of making 366 columns and naming them day_0 .. day_366 with content (off/on),
and when writing, check the date entered by the person, convert it to the ordinal number of the day in the year and, based on this, make a query to the database and display suitable masters who, for example, have day_33 == on tell me whether I think correctly or there are options for solving my problem in some other way without such clogging of the database?
I am creating a small CRM system and there are partners who have masters and it is necessary to implement it in such a way that the partner can edit the schedule of each individual master himself.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Konstantin Tsvetkov, 2019-11-07
@tsklab

Standard scheme: employee, work schedule, time sheet. And for you an addition: a task.

list of masters based on selected date
This is a report card, a list of masters working that day. Actual, compiled on the basis of the schedule (that is, who, when will work, taking into account the weekend). On its basis, orders (tasks) are issued, because the master can perform several tasks per day (or not).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question