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是另一個列,該列被引用