21

I have a column in MySQL with the type DECIMAL(2,1). When I insert the number 10 into the database it reads 9.9. I want it to read 10.0. Any ideas? Thanks.

1

1 Answer 1

58

DECIMAL(2,1) means (as the manual suggests) a decimal of 2 characters wide (in total!) and 1 decimal. If you want 10.0, you need DECIMAL(3,1) (three wide, one decimal).

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.