如何修改mysql表中字段类型
如何修改mysql表中字段类型,我有一个字段是double(32,2)类型,我现在想把他修改成int类型,语句如何写啊
SQL code:
alter table 表名 change 字段 字段 int not null;
SQL code:
mysql> desc tx;
+-------+---------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+---------+------+-----+---------+-------+
| id | int(11) | YES | | NULL | |
| col1 | double | YES | | NULL | |
+-------+---------+------+-----+---------+-------+
2 rows in set (0.06 sec)
mysql> alter table tx modify col1 int;
Query OK, 0 rows affected (0.13 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql> desc tx;
+-------+---------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+---------+------+-----+---------+-------+
| id | int(11) | YES | | NULL | |
| col1 | int(11) | YES | | NULL | |
+-------+---------+------+-----+---------+-------+
2 rows in set (0.00 sec)
mysql>
alter table tx modify column col1 int;
相关问答:
我用一个循环往数据库里面存文件,本来可以作为文件存放数据库里面只放文件的位置的,但是没有办法租的服务器网页空间大小有限制数据库没有限制。语句是这样的
public static final DataBase.MAXSIZE=102 ......
我是用mysql自带的C API
if(mysql_real_connect(&mysql,"125.0.0.108","root","root","home",3306,NULL,0))
{
AfxMessageBox("数据库连接失败") ......
环境:win2003 apache2 resin3 php5 mysql5
mysql错误里出现这个,服务器直接死到那里。
InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_log ......
我在书上看到说每一个表都属于某一个模式,如果要为表指定模式,有三种方法:
1)
在创建表时显式的给出模式名,比如create table "xxx".sno(......);
2)
在创建模式的时候同时创建表
3) ......
有个winform程序,使用c#+mysql,需要在一个窗体设置mysql自动删除功能,包括自动删除多少天之前的数据以及是否开启自动删除功能,我程序退出后,还怎么控制Mysql自己删除啊?是不是要用mysql的event来实现?c#可以调用mysq ......