cuốn sách gpt4 ai đã làm

mysql float 据字段不接受每个 float

In lại Tác giả: Hồ Xil 更新时间:2023-11-01 08:34:10 25 4
mua khóa gpt4 Nike

我有一个 float 数据字段:

`total` float(20,2) unsigned NOT NULL,

我想插入一个 float ,如:“815032.68”,但它不被接受,数字四舍五入为 815032.69。为什么?

câu trả lời hay nhất

sử dụng定点数据类型

`total` DECIMAL(20,2) unsigned NOT NULL

The DECIMAL and NUMERIC types store exact numeric data values. These types are used when it is important to preserve exact precision, for example with monetary data.

MySQL Doc

浮点数据类型只能存储approximate numbers .

关于mysql float 据字段不接受每个 float ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18208061/

25 4 0
Chứng chỉ ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com
Xem sitemap của VNExpress