mysql - SQL correct definition of floating points -


i measuring values on geo-location need create table consists of:

date  longitude latitude value 

the date column date of measure, value int value of measure, longitude , latitude coordinates - floating points columns 3 digits before point , 5 after (i.e. *.*)

i'm wondering how define table, try use:

create table `obs` (   `id` int(11) not null auto_increment,   `date` date default null,   `lon` decimal(5,5) default null,   `lat` decimal(5,5) default null,   `val` int(11) not null,   primary key (`id`) ) engine=innodb default charset=utf8; 

here link sqlfiddle

but when i'm trying run

insert `obs` values (null,'2014/06/07','34.000','31.342',1) 

i getting following error:

out of range value column 'lon' @ row 1:

can explain me what's wrong?

decimal(5,5) means

5 decimal places in total 5 decimal places after point 

that make numbers invalid having decimal place before point.

you want

decimal(10,5) 

Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -