N
N
Nikita Tratorov2014-02-06 12:33:40
SQL
Nikita Tratorov, 2014-02-06 12:33:40

What are the ways to store the mode of operation of institutions?

Colleagues!
Please share your experience when trying to optimally and flexibly keep the working hours of institutions for a week.
Perhaps someone has experience encoding an hourly table into a matrix?
384216_142430.jpg

Answer the question

In order to leave comments, you need to log in

3 answer(s)
G
Grigory Perepechko, 2014-03-04
@GrigoryPerepechko

You deliberately introduce denormalization and break even the first normal form.
Think about what the SQL query will look like that will look in your packaged table for organizations working on Monday at 2 pm and at 6 pm. If it suits you in its complexity, you can leave the solution, if not, normalize it.

R
Rsa97, 2014-02-06
@Rsa97

You can pack as you like, depending on what you need to display later.
If the work is without lunch, it is enough to store the beginning and end of the working time for each day of the week. If with lunch, add the start and end times of the lunch. If the interval is complex - store for each hour the sign "working / not working", you can pack the whole day into 24 characters or 24 bits.

G
german levi, 2017-11-07
@levi-german

no one offered an example with a piece of code ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question