开发者

default a column with empty string

开发者 https://www.devze.com 2023-01-09 13:12 出处:网络
Is there a way, via a SQL statement, to ensure a column\'s default value is an empty string开发者_如何学JAVA \'\' instead of NULL?Yes - use a DEFAULT constraint:

Is there a way, via a SQL statement, to ensure a column's default value is an empty string开发者_如何学JAVA '' instead of NULL?


Yes - use a DEFAULT constraint:

DROP TABLE IF EXISTS `example`.`test`;
CREATE TABLE  `example`.`test` (
  `string_test` varchar(45) NOT NULL DEFAULT ''
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
0

精彩评论

暂无评论...
验证码 换一张
取 消