MySQL,给定的默认值不适用于所需的列
我已经创建了一个表(RJY),其中一个列具有默认值。当我输入命令“descripe rjy;”它向我显示默认列和我给定的值 当我使用insert命令将数据插入到表中时,具有默认值的列保留为空,并且不接受我给定的值。下面是我的问题,请解决它MySQL,给定的默认值不适用于所需的列,mysql,Mysql,我已经创建了一个表(RJY),其中一个列具有默认值。当我输入命令“descripe rjy;”它向我显示默认列和我给定的值 当我使用insert命令将数据插入到表中时,具有默认值的列保留为空,并且不接受我给定的值。下面是我的问题,请解决它 mysql> insert into rjy (compy_id, reqrmnt, veh_type, go_type, weigh, l_start,l_end) values ('123456', '111', '12 ty', 'white c
mysql> insert into rjy (compy_id, reqrmnt, veh_type, go_type, weigh, l_start,l_end)
values ('123456', '111', '12 ty', 'white cemt', '1 tons', '', 'mumbai');
这里我给了“l_开始”字段默认值
谢谢。好吧,在insert查询中为字段指定一个值(即使是空值) 若要使用默认值,应将插入更改为
insert into rjy (compy_id, reqrmnt, veh_type, go_type, weigh, ,l_end)
values ('123456', '111', '12 ty', 'white cemt', '1 tons', 'mumbai');
不要在insert查询中包含该列。这样做:
insert into rjy (compy_id, reqrmnt, veh_type, go_type, weigh, l_end)
values ('123456', '111', '12 ty', 'white cemt', '1 tons', 'mumbai');