mysql 3813:Column check constraint 'tb_course_chk_3' references other column.


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

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM