将列中的列从int更改为double? [英] Changing Column in MySQL from int to double?

查看:593
本文介绍了将列中的列从int更改为double?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基本上,我目前在MySQL表中有一列,这是一个int。



我想将其改为双倍。我已经搜索过网络,但是所有这些都是从列中获取值(如将某个日期转换为日期)进行转换,但这不是我的意思。


我猜这是Alter Table的东西,我在MySQL开发页面上看到了,但找不到我想要的东西。解决方案

这是真正的语法。确保适当地设置可空性:

  ALTER TABLE your_table 
MODIFY COLUMN your_column DOUBLE NULL;

  ALTER TABLE your_table 
MODIFY COLUMN your_column DOUBLE NOT NULL;


Basically, I currently have a column in a MySQL table, which is an int.

I'd like to change that to double. I've searched the web, but all it came up with was conversion upon getting the values from the column (like converting some date to Date), but that's not what I mean.

I'm guessing it's something with Alter Table, and I looked that up on the MySQL dev page, but could not find what I was looking for.

解决方案

Here's the real syntax. Make sure to set the nullability appropriately too:

ALTER TABLE your_table
MODIFY COLUMN your_column DOUBLE NULL;

or

ALTER TABLE your_table
MODIFY COLUMN your_column DOUBLE NOT NULL;

这篇关于将列中的列从int更改为double?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆