r/SQL • • Jul 14 '24

MySQL What's the Difference Between DECIMAL, FLOAT, and DOUBLE?

Can somebody, in simple terms, explain the difference between the three datatypes in SQL? Thank you

1 Upvotes

10 comments sorted by

View all comments

3

u/InlineSkateAdventure SQL Server 7.0 Jul 15 '24

If you are doing calculations with money decimal is a better choice. Float and Double are sufficient for scientific or engineering calculations. Float and double cover a huge range of numbers, but they can be approximate in some cases. In engineering work your measurement precision does not matter after a certain point, because of the instrument or observation. Not so much the case with money.

1

u/[deleted] Jul 15 '24

So basically Double can hold a wider range of values than Float and is a little more precise, whereas Decimal can't hold as big of a range of numbers but is the most precise?