如何将文本更改为MySQL中的小数?
我的MySQL数据集中有很多数据类型文本的值(以前百分比)。
它们看起来都像24.05、0.25、46.3、5.2等。
我想将它们转换为数据类型,以便我以后将它们乘以它们,以便通过将这些百分比乘以0.01。
我尝试过,
ALTER TABLE table_name
MODIFY COLUMN col_name binary/decimal/int.
我不知道该怎么做。
谢谢你!
I have plenty of values(previously percentages) of data type text in my MySQL dataset.
They all look like 24.05, 0.25, 46.3, 5.2, etc.
I want to convert these to a data type that will allow me to multiply them later on so that I can make these percentages into complete decimals by multiplying by 0.01.
I've tried
ALTER TABLE table_name
MODIFY COLUMN col_name binary/decimal/int.
I can't figure out how to do this though.
Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用
十进制
datatype。我将
sakila db
作为示例如图所示。这意味着租金总共可以承担5位数字。小数点之后,其中两个出现在右边
You may use the
DECIMAL
datatype.I used the
sakila db
as an example as shown;meaning the rental rate can assume a total of 5 digits. two of them appearing to the right after the decimal point