Numeric Type
By the end of this section, you will learn about the NUMERIC data type that Oxla supports - the integer type (Integer & Long) and the floating point type (Float & Double).
Integer Type
The INTEGER data type is whole numbers, and they do not have decimal numbers. It is 32-bit signed and has a limit from -32,768 to 32,768.
Format
Example
The following is an example of how to create a column using an INTEGER type:
Now, run the following query to display the table:
You will get the following table as the output:
Long Type
The LONG data type is similar to Integer but is designed to store numbers exceeding the INTEGER range limit. This is 64-bit signed and has a limit from -2,147,483,648 to 2,147,483,648.
Format
Example
The following is an example of how to create a column using a LONG type:
Now, run the following query to display the table:
You will get the galaxies' names and their stars as the final output:
Float Type
The FLOAT data type is a 32-bit floating-point number with n precision.
Format
Example
1) Create a table
Here we are creating a numbers table named with a FLOAT type:
The following is the table showing that the column can contain at least six decimal digits:
2) Rounding
Rounding might happen if the precision of an input number is too high.
Here is the rounding result from the above command:
3) Create a table with numbers exceeding the range
FLOAT type only stores 32-bit floating-point numbers. In this example, we input the numbers that exceed the range:
The final output will only return numbers that match the range:
Double Type
The DOUBLE data type is a 64-bit floating-point number with n precision.
Format
Example
1) Create a table
Here we are creating a numbersdouble table named with a DOUBLE type.
The following is the table showing that the column can contain at least fifteen decimal digits:
2) Rounding
Rounding might happen if the precision of an input number is too high.
Here is the rounding result from the above command:
