在 mysql outfile 期间保留十进制 0

Retaining Decimal 0 during mysql outfile

所以我有一个像这样的 table 结构,

CREATE TABLE DATA_0 (ID BIGINT(15), I_R_A int(10) DEFAULT NULL, I_NO varchar(200) DEFAULT NULL, V_x double(10,1) DEFAULT NULL);

像这样的示例数据,

ID,I_R_A,I_NO,V_x
1,10000,9895987650, 10000.0
2,60,2424, 60.0
3,70,34, 70.0
4,80,34245, 80.0

执行以下输出文件查询时-

SELECT ID,I_R_A,I_NO,V_x INTO OUTFILE "/home/user/out.txt" FIELDS TERMINATED BY ',' LINES TERMINATED BY '\r\n' FROM DATA_0;

我的输出文件是这样的-

ID,I_R_A,I_NO,V_x
1,10000,9895987650, 10000
2,60,2424, 60
3,70,34, 70
4,80,34245, 80

如您所见,十进制 0 已从 删除 V_x。我怎样才能保留这个 0?

使用FORMAT函数

SELECT ID,I_R_A,I_NO, REPLACE(FORMAT(V_x, 1), ',', '')
INTO OUTFILE "/home/user/out.txt" 
FIELDS TERMINATED BY ',' LINES TERMINATED BY '\r\n' 
FROM DATA_0;