我有一个 MySQL-DB,它是这样创建的:
create table vacation
(
worker_id smallint not null,
vacation_start date not null,
vacation_end date not null,
primary key (f_actors_id, vacation_start)
);
现在,我的想法是“1 个用户每天只能开始 1 个假期”,但我没有想到一个用户今天和明天要休 4 周的假期。数据库会接受这一点。
是否有任何(不是脚本端,它应该是 mysql 端)- 说“使用那个字段,只有在这些日期之间没有其他以前的假期的情况下才使用那个字段?”?
谢谢!
最佳答案
在插入或更新之前使用触发器。
关于mysql - 防止mysql中的 "double holiday taking",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6648412/