Before we continue, let's review what we know about numbers already.
Integer numbers are expressed in the normal, intuitive way:
-27 etc. Fractions are expressed with a dot (
-401.238, etc. Please note that in some languages you use a comma instead of a dot, but you cannot do it in SQL (
12,45 is incorrect)!
In SQL (and in most programming languages) there are three kinds of number types:
- integer type - they store integers,
- floating point numbers - they store fractions in binary format,
- decimal numbers - they store fractions in decimal format.
In this part we'll discuss some of the differences between various numeric data types in SQL.
Of course, you can use the four basic mathematical operations:
/ with numbers in SQL. You can also use columns and constant numbers together, for instance: