技术分享 | check(col_name<>'')为何把空格拒之门外
1、问题描述前两天在群里看到同事反馈一个空格问题,大致现象如下:mysql>selectversion;++version++8.0.25++1rowinset(0.00sec)mysql>createtablet1(>c1int,>c2varchar(4)check(c2<>'')单引号之间无空格>)engineinnodb;QueryOK,0rowsaffected(0.21sec)mysql>insertintot1select1,'';c2字段插入两个空格ERROR3819(HY000):Checkconstraint't1chk1'isviolated.check定义c2'',往c2字段插入空格,提示违反check约束。为什么insert...