[英]How to manage availability of a user in MySQL database tables
I am trying to make a database design and I have a tutor which can set his availability in two ways :我正在尝试进行数据库设计,并且我有一位导师可以通过两种方式设置他的可用性:
How do I design tables in order to save this availability information ?我如何设计表格以保存此可用性信息?
For example provided your DB supports Time
type, pseudocode例如,如果您的数据库支持
Time
类型,伪代码
GeneralAvailability (
TutorId int not null,
DayOfWeek int not null, /* 1 .. 7*/
TimeFrom Time not null,
TimeTo Time not null
)
SpecialAvailability (
TutorId int not null,
AvailDate Date not null,
TimeFrom Time not null,
TimeTo Time not null
)
or generalized one或广义的
Availability (
TutorId int not null,
DayOfWeek int, /* 1 .. 7, null */
AvailDate Date,
TimeFrom Time not null,
TimeTo Time not null,
CHECK ((DayOfWeek IS NULL OR AvailDate IS NULL) AND (DayOfWeek IS NOT NULL OR AvailDate IS NOT NULL))
)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.