Design to register random regular holidays

Asked 1 years ago, Updated 1 years ago, 85 views

I'm making data on the tourist attraction list, but I'm having trouble setting up regular holidays.

Specifically

close_mon~close_sun

I have prepared the columns in and judge them by 0,1, but depending on the location
There are many random cases such as "Closed on the second Tuesday and the third Monday" and "Closed on Transfer Holidays."

In this case, how do you prefer to prepare and design table columns?

mysql database-design

2022-09-29 21:48

2 Answers

It's personal, but if you don't mind roughing it, the regular holidays are
Since it converges into almost the same pattern, make the pattern part a separate table.

Table 1
close_id ID column to be associated with a fixed holiday pattern

Table 2
close_id
close_pattern Fixed Holiday Pattern (calculated)

If the expected number of holiday patterns converges to a certain number, then
If it becomes extremely large (thousands of patterns, etc.), I will break it down and make it.
For example,
Closed on the second Tuesday and the third Monday
This is a combination of the regular holidays of the second Tuesday and the third Monday.

Another way to do this is to prepare a calendar table and
You set it to ON/OFF all day.

 shop_holiday - Example Table
 id, year, switch - column
 a01,2015,11100011100000 to 365 digits 1 and 0 represent holidays - data


2022-09-29 21:48

I've done something similar, but
·Closed on the second Wednesday
·Last Thursday off
·Closed on the second and fourth Friday of odd number month
·Closed on Mondays, but closed on national holidays and closed on Tuesday the next day
There were patterns such as this, and it was still difficult to define.
In my case, the number of cases was small, so I gave up using only columns.
We have prepared the above conditional types and the parameters to be added to the record.

month comma-separated month Week Comma Separated Week 6 represents the last week
Specify the day number (0-6)
Opt Holiday Business?
Additionally, special conditional decisions increase the definition of opt
Acquire all cases or display targets, and determine "Are you off today?" one by one on the code side.
Failed to display.
If you want to get it only during business today, you may be able to do something with the function.


2022-09-29 21:48

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.