mysql怎么用sql语句修改某个列的数据类型? 标准的SQL语句修改某个列的类型是这样的:alter table [表的名称] alter column [列的名称] [数据类型]但是当我用这种语法在MySQL中修改某个列的类型时,MySQL会提示语法错误。不知道在MySQL中怎么用sql语句来修改列的类型呢? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 ALTER TABLE b MODIFY gg VARCHAR(10) ALTER TABLE t1 CHANGE b b BIGINT NOT NULL; ALTER TABLE t1 MODIFY b BIGINT NOT NULL; alter table b change up up varchar(10);mysql> desc b;+-------------+-------------+------+-----+---------+----------------+| Field | Type | Null | Key | Default | Extra |+-------------+-------------+------+-----+---------+----------------+| id | int(4) | NO | PRI | NULL | auto_increment || foreignName | varchar(45) | YES | | NULL | || up | float | YES | | NULL | || down | float | YES | | NULL | |+-------------+-------------+------+-----+---------+----------------+4 rows in set (0.02 sec)mysql> alter table b change up up varchar(10);Query OK, 4 rows affected (0.19 sec)Records: 4 Duplicates: 0 Warnings: 0mysql> desc b;+-------------+-------------+------+-----+---------+----------------+| Field | Type | Null | Key | Default | Extra |+-------------+-------------+------+-----+---------+----------------+| id | int(4) | NO | PRI | NULL | auto_increment || foreignName | varchar(45) | YES | | NULL | || up | varchar(10) | YES | | NULL | || down | float | YES | | NULL | |+-------------+-------------+------+-----+---------+----------------+4 rows in set (0.00 sec)mysql> 具体语法,你可以参考alter table MySQL官方文档 http://dev.mysql.com/doc/refman/5.1/zh/index.html 数据库查询的SQL语句问题 find_in_set是否效率更高哦 create user a01 identified by '123'后不能用密码登录? MySQL语法问题。1064错误。 Cannot load JDBC driver class 'com.mysql.jdbc.Driver' MySql查询上周以及上月时间段问题??? 100大分,寻高手解决!SQL2000下的MYSQL链接服务器不能执行远程INSERT mysql地连接问题? 怎样获得ID号存在于a表中同时不存在于b表中的记录,唉,MYSQL,还是太弱 站内多关键词搜索 Mysql执行.sql文件 多表查询排序
+-------------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+-------------+------+-----+---------+----------------+
| id | int(4) | NO | PRI | NULL | auto_increment |
| foreignName | varchar(45) | YES | | NULL | |
| up | float | YES | | NULL | |
| down | float | YES | | NULL | |
+-------------+-------------+------+-----+---------+----------------+
4 rows in set (0.02 sec)mysql> alter table b change up up varchar(10);
Query OK, 4 rows affected (0.19 sec)
Records: 4 Duplicates: 0 Warnings: 0mysql> desc b;
+-------------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+-------------+------+-----+---------+----------------+
| id | int(4) | NO | PRI | NULL | auto_increment |
| foreignName | varchar(45) | YES | | NULL | |
| up | varchar(10) | YES | | NULL | |
| down | float | YES | | NULL | |
+-------------+-------------+------+-----+---------+----------------+
4 rows in set (0.00 sec)mysql>
MySQL官方文档 http://dev.mysql.com/doc/refman/5.1/zh/index.html