为已经存在的表添加非空约束:
1.alter TABLE tablename MODIFY column_name int(11) not null DEFAULT 0;-- 条件,修改的列里面不能有null值,
2.alter TABLE tablename change column_name column_name int(11) not null DEFAULT 0;-- column_name出现两次
本文介绍如何使用SQL语句为已存在的表中的特定列添加非空约束,并提供了两种不同的方法实现这一目的。
为已经存在的表添加非空约束:
1.alter TABLE tablename MODIFY column_name int(11) not null DEFAULT 0;-- 条件,修改的列里面不能有null值,
2.alter TABLE tablename change column_name column_name int(11) not null DEFAULT 0;-- column_name出现两次
6127
1036

被折叠的 条评论
为什么被折叠?