自分は、以下のようなテーブルを作って管理することが多いですね。曜日ごとの営業時間の開始と終了を入れます。
昼休みなどで連続していない時間があるなら、レコード分ければ対応できます。
sql
1CREATE TABLE `shops` (
2 `id` int(11) NOT NULL AUTO_INCREMENT,
3 `name` varchar(255) NOT NULL,
4 PRIMARY KEY (`id`)
5);
6
7CREATE TABLE `shop_times` (
8 `id` int(11) NOT NULL AUTO_INCREMENT,
9 `shop_id` int(11) NOT NULL, -- 外部キー (shops.id)
10 `weeks` varchar(255) NOT NULL, -- 週数
11 `mon_start` time DEFAULT NULL,
12 `mon_end` time DEFAULT NULL,
13 `tue_start` time DEFAULT NULL,
14 `tue_end` time DEFAULT NULL,
15 `wed_start` time DEFAULT NULL,
16 `wed_end` time DEFAULT NULL,
17 `thu_start` time DEFAULT NULL,
18 `thu_end` time DEFAULT NULL,
19 `fri_start` time DEFAULT NULL,
20 `fri_end` time DEFAULT NULL,
21 `sat_start` time DEFAULT NULL,
22 `sat_end` time DEFAULT NULL,
23 `sun_start` time DEFAULT NULL,
24 `sun_end` time DEFAULT NULL,
25 `hol_start` time DEFAULT NULL,
26 `hol_end` time DEFAULT NULL,
27 PRIMARY KEY (`id`)
28);
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/12/04 06:47
2016/12/04 07:40 編集
2016/12/04 08:42