为什么我会收到错误 1264:第 1 行的 'ping' 列值超出范围?
Why am I getting error 1264: Out of range value for column 'ping' at row 1?
ping 的大小是 10,
table 数据为 {'ping': 48.68, 'download': 0.41, 'upload': 0.12}
那么大小为 5 的浮点值怎么抛出错误:
mysql.connector.errors.DatabaseError: 1264: Out of range value for column 'ping' at row 1
这是我的mysqltable
+----------------+--------------+------+-----+-------------------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------------+--------------+------+-----+-------------------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| ping | float(10,10) | YES | | NULL | |
| download | float(10,10) | YES | | NULL | |
| upload | float(10,10) | YES | | NULL | |
| datetime_added | timestamp | NO | | CURRENT_TIMESTAMP | |
+----------------+--------------+------+-----+-------------------+----------------+
类型:
MySQL permits a nonstandard syntax: FLOAT(M,D) or REAL(M,D) or DOUBLE PRECISION(M,D). Here, (M,D) means than values can be stored with up to M digits in total, of which D digits may be after the decimal point.
因此:float(10,10)
不允许存储 48.68。小数点前只能是0
.
ping 的大小是 10,
table 数据为 {'ping': 48.68, 'download': 0.41, 'upload': 0.12}
那么大小为 5 的浮点值怎么抛出错误:
mysql.connector.errors.DatabaseError: 1264: Out of range value for column 'ping' at row 1
这是我的mysqltable
+----------------+--------------+------+-----+-------------------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------------+--------------+------+-----+-------------------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| ping | float(10,10) | YES | | NULL | |
| download | float(10,10) | YES | | NULL | |
| upload | float(10,10) | YES | | NULL | |
| datetime_added | timestamp | NO | | CURRENT_TIMESTAMP | |
+----------------+--------------+------+-----+-------------------+----------------+
类型:
MySQL permits a nonstandard syntax: FLOAT(M,D) or REAL(M,D) or DOUBLE PRECISION(M,D). Here, (M,D) means than values can be stored with up to M digits in total, of which D digits may be after the decimal point.
因此:float(10,10)
不允许存储 48.68。小数点前只能是0
.