separate table or no for days closed
Posted by: Dimitris Papageorgiou
Date: May 06, 2021 07:07AM

I have a table that store the business hours of a business for each weekday:
CREATE TABLE `store_open` (
`id` int NOT NULL AUTO_INCREMENT,
`b_user_ID` mediumint unsigned DEFAULT NULL,
`open_time` time DEFAULT NULL,
`close_time` time DEFAULT NULL,
`open_time_b` time DEFAULT NULL,
`close_time_b` time DEFAULT NULL,
`day` tinyint DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `b_user_ID` (`b_user_ID`),
KEY `day_idx` (`day`),
CONSTRAINT `day` FOREIGN KEY (`day`) REFERENCES `weekdays` (`dayID`)
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8

the day foreign key references a table that holds the days of the week...

CREATE TABLE `weekdays` (
`dayID` tinyint NOT NULL AUTO_INCREMENT,
`days` varchar(45) DEFAULT NULL,
PRIMARY KEY (`dayID`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8

Quesion:
I need to store also the day when the business will be closed...ccurrently the above schem does not cater for that....so...I have concluded maybe it is better to create an extra column to the store_open table..probably boolean that will give info about which day the business is closed...default value will be open(assigned to 0)..and when one day the business is closed the value will be 1(true in other words).

What do you think?

Options: ReplyQuote


Subject
Written By
Posted
separate table or no for days closed
May 06, 2021 07:07AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.