如何在数据库中存储经度和纬度。 MySQL不会超过-99.9999999 [英] How to store longitude and latitude in database. MySQL won't go further than -99.9999999
问题描述
确定现在我正在将lat和lng列存储为 DECIMAL(10,8)
Ok right now I'm storing lat and lng columns as DECIMAL(10,8)
I 'm尝试插入:
-117.1779216
但是它仍然插入: -99.99999999
为什么?我看到每一个其他板存储它作为DECIMAL,但它不会回来更多,当我给它在期间前10个地方...所以我会认为它可以去-117 ..没有人都被标记为 unsigned
。
Why is this? I see every other board storing it as DECIMAL, but it won't go back more when I'm giving it 10 places before the period... So I would think it could go -117.. None of them are marked as unsigned
either.
推荐答案
Precision(10) - Scale(8)= 2
Precision (10) - Scale (8) = 2
2是十进制左侧的数字数字
2 is the number of digits you can have to the left of the decimal
如果提高精度,可以在十进制的左边有更多的数字。
If you increase the precision, you can have more digits to the left of the decimal.
这篇关于如何在数据库中存储经度和纬度。 MySQL不会超过-99.9999999的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!