alter table tb_course add selected int(3) not null default 0  check ( selected between 0 and total_people ) comment '课程已选人数';

报错:Column check constraint 'tb_course_chk_3' references other column. 列检查约束不能引用其他列

 

alter table tb_course add selected int(3) not null default 0 comment '课程已选人数';
alter table tb_course add constraint ck_selected check ( tb_course.selected between 0 and tb_course.total_people); #total_people是另一个列,该列被引用

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-10-25
  • 2022-12-23
  • 2022-12-23
  • 2022-01-09
  • 2021-09-03
  • 2021-11-16
相关资源
相似解决方案