From the course: Programming Foundations: Databases

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

Numbers and other types

Numbers and other types

- Databases also offer specific data types for different kinds of numbers. These types are for integers, double precision numbers, floating point numbers, decimals of varying length, and more. As you need to store specific kinds of numbers, you'll need to do a little research to find out the best data type for your information. It's important to be precise when choosing the data type for working with numbers so that you don't run into issues with rounding or other pitfalls that can cause problems with your data. We'll use a decimal type for the prices of our dishes sent to three digits and two digits representing three places for dollars and two places for cents. None of our dishes will be $1,000 and none of our dishes will have fractional cents beyond two digits, so this will work just fine. It's worth taking a moment to talk about how we store phone numbers, too. Phone numbers aren't strictly numbers like an integer.…

Contents