© 2024 fjorge. All rights reserved.
The difference between Decimal and Float SQL datatypes
What is the difference between Decimal and Float datatypes in SQL? Well you can accomplish the same with both but there are advantages to each.
First off the syntax is quite different.
Float(char_length)
Decimal(total_length, length_right_of_decimal)
So you can see with decimal you may get more precision as it will never round. If you need some major finance calculations, decimal is the preferred route.
However if extreme precision is not needed and you have varying lengths of decimals, floats certainly make it easier.