mysql中text字段如何设默认值啊 default ‘’数据库里面还是个NULL。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 在mysql中,字符串类型的''与NULL是等价的吧。mysql> create table ttt(id int primary key, col2 text default '');Query OK, 0 rows affected (0.09 sec)mysql> insert into ttt values(1, null);Query OK, 1 row affected (0.03 sec)mysql> select * from ttt;+----+------+| id | col2 |+----+------+| 1 | NULL |+----+------+1 row in set (0.00 sec)如果default 不为''mysql> create table ttt(id int primary key, col2 text not null default 'abc');ERROR 1101 (42000): BLOB/TEXT column 'col2' can't have a default valueBLOB/TEXT类型是不能有非空的default value的。我用的mysql的版本是5.0.9 谢谢,我也是这么想的。那个破hibernate非要非空字段。气人啊。 请教一下多对多关系的实现 mysql用控制台突然无法登陆了,报1045错误 MySQL 服务器启动问题 怎么合并多张字段不一致的表(100分) MySQL的存储过程如何让列名做变量 请大家帮帮忙 MySql中的函数(由Ms_Sql转换而来) my sql连接 mysql支持中文全文检索吗?该怎么弄呢? 请问sql mysql 的in 操作怎么这么耗时,能不能优化一下 MySQL如何实现INTERSECT?
mysql> create table ttt(id int primary key, col2 text default '');
Query OK, 0 rows affected (0.09 sec)mysql> insert into ttt values(1, null);
Query OK, 1 row affected (0.03 sec)mysql> select * from ttt;
+----+------+
| id | col2 |
+----+------+
| 1 | NULL |
+----+------+
1 row in set (0.00 sec)如果default 不为''
mysql> create table ttt(id int primary key, col2 text not null default 'abc');
ERROR 1101 (42000): BLOB/TEXT column 'col2' can't have a default valueBLOB/TEXT类型是不能有非空的default value的。
我用的mysql的版本是5.0.9
那个破hibernate非要非空字段。气人啊。