charlie
charlie

Reputation: 481

store how to large decimal numbers in mysql

i have a column in my table currently set as decimal(10,2)

but i want to be able to store 0.001299999999 which would round to 0.0013

how should this be stored in my MySQL table?

Upvotes: 1

Views: 2710

Answers (1)

Sadikhasan
Sadikhasan

Reputation: 18600

DECIMAL (10,8)

The declaration syntax for a DECIMAL column is DECIMAL(M,D). The ranges of values for the arguments in MySQL 5.7 are as follows:

M is the maximum number of digits (the precision). It has a range of 1 to 65.

D is the number of digits to the right of the decimal point (the scale). It has a range of 0 to 30 and must be no larger than M.

Reference

Upvotes: 4

Related Questions