Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools Database Foundations Introduction to Data, Databases and SQL Introduction to Data Types

Miguel Nunez
Miguel Nunez
3,266 Points

Whats the point of a floating point data type In SQL

Don't judge me if I don't understand or explain this correctly but using the floating point aka the dot (decimal) that is said to move randomly in a number If used, So what's so special about that and what and why would people use this for? I some times think the creators of these languages are illogical sometimes but please respond back in simplicity please no fancy smart words or fancy jargon. Simplicity is key.

1 Answer

Miguel Nunez
Miguel Nunez
3,266 Points

I read that earlier still complicated to understand. So I know now that decimals are for money data ,basic decimal stuff but when to comes to floats what are they usually used for are they used for scientific notations data?

Alexander Nikiforov
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Alexander Nikiforov
Java Web Development Techdegree Graduate 22,175 Points

I think yes.

Float is better be used with scientific data, because we round up here and there for scientific needs, and sometimes you don't know how much digits are important.

And also quoting

Instead, you can use float, which internally stores everything as a log of base 2. That allows a the full range of precision in one field with the drawback that only the first ~8 digits will be accurate

Most of the times in science you just need to know the order and ~8 digits, that is enough. And you can approximate the rest.

And decimals as you said : money, mostly or other fixed point numbers, where you have to know exactly, and where you simply cannot approximate.