HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

double (3,3) > sending 1.3 > stored 0.999

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
storeddoublesending999

Problem

It is knocking my socks off...
MySQL DB

weight is defined as double (3,3)

INSERT INTO xxx (`weight`) VALUES ( 1.3)


why does the DB store 0.999?

Solution

(3,3) indicates a total length of 3 digits, with 3 decimal places. Perhaps you want (6,3).

See the MySQL Docs for details.

Context

StackExchange Database Administrators Q#205065, answer score: 9

Revisions (0)

No revisions yet.