如果字段类型从字符型更变为数值型, 是不是原来的字符一律都会变成0? 原字段类型为var, 有部分数据为数值(如"100"),部分数据为字符("不限"),变更类型到数值型,如INT,是不是那些字符都变成0,数值的那些结果不变,只是类型变了?谢谢! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 [email protected]_monitor>select * from test;+----+-------+| id | value |+----+-------+| 1 | 1 | | 2 | 2 | | 3 | 3 | | 4 | 5 | | 5 | 6 | | 6 | a | | 7 | b | | 8 | abc | +----+-------+8 rows in set (0.00 sec)[email protected]_monitor>alter table test modify value int;Query OK, 8 rows affected, 3 warnings (0.03 sec)Records: 8 Duplicates: 0 Warnings: [email protected]_monitor>select * from test;+----+-------+| id | value |+----+-------+| 1 | 1 | | 2 | 2 | | 3 | 3 | | 4 | 5 | | 5 | 6 | | 6 | 0 | | 7 | 0 | | 8 | 0 | +----+-------+8 rows in set (0.00 sec)当更改表内的数据列类型时,mysql会自动调用convert或者cast,我测试了一下[email protected]_monitor>select convert('a',UNSIGNED); +-----------------------+| convert('a',UNSIGNED) |+-----------------------+| 0 | +-----------------------+1 row in set, 1 warning (0.00 sec)mysql会直接将非数字转化成0 一个多表查询的问题。。。求解 如何获得当前自增ID 如何向数据库中插入二进制文件?我用的是c++/connector MySql的存储过程里如何添加一个事务?请高手指点! MYSQL 如何防止同一条记录被多人下载 简单问题, MYsql客户端乱码 mysql 触发器删除 大哥帮忙优化一下mysql数据库的索引,谢谢 mysql 中,如何把datetime字段,改成 date 字段,用什么函数? 更新数据表 mysql 如何监控表结构修改
+----+-------+
| id | value |
+----+-------+
| 1 | 1 |
| 2 | 2 |
| 3 | 3 |
| 4 | 5 |
| 5 | 6 |
| 6 | a |
| 7 | b |
| 8 | abc |
+----+-------+
8 rows in set (0.00 sec)[email protected]_monitor>alter table test modify value int;
Query OK, 8 rows affected, 3 warnings (0.03 sec)
Records: 8 Duplicates: 0 Warnings: [email protected]_monitor>select * from test;
+----+-------+
| id | value |
+----+-------+
| 1 | 1 |
| 2 | 2 |
| 3 | 3 |
| 4 | 5 |
| 5 | 6 |
| 6 | 0 |
| 7 | 0 |
| 8 | 0 |
+----+-------+
8 rows in set (0.00 sec)当更改表内的数据列类型时,mysql会自动调用convert或者cast,我测试了一下
[email protected]_monitor>select convert('a',UNSIGNED);
+-----------------------+
| convert('a',UNSIGNED) |
+-----------------------+
| 0 |
+-----------------------+
1 row in set, 1 warning (0.00 sec)
mysql会直接将非数字转化成0