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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.