我有一个名为 practice
的表其中存在 firstname 列,我正在尝试执行以下查询。
alter table practice alter firstname not null ;
我得到了这个语法:
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'varchar not null' at line 1
需要澄清语法错误。
最佳答案
在更改列时,您必须指定数据类型
并使用Modify
关键字才能设置空或非空参数
例如:
alter table practice modify firstname varchar(25) not null ;
关于mysql - MySql 查询非空约束时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48661958/