Numeric Type
The INT data type is whole numbers, and they do not have decimal numbers. This is 32-bit signed and has a limit from -2147483648 to 2147483647.
The following is an example of how to create a column using an INT type:
Now, run the following query to display the cities table:
It will show the cities table as shown below:
The BIGINT data type is similar to an Integer but is designed to store numbers exceeding the INT range limit. This is 64-bit signed and has a limit from -9223372036854775808 to 9223372036854775807.
The following is an example of how to create a column using the BIGINT type:
Now, run the following query to display the table:
You will get the galaxy names and their stars as the final output:
The REAL data type is a 32-bit floating-point number.
1) Create a Table
Here, we are creating a table named "numbers” with a REAL column type.
Display the table with the following query:
The following table shows that the column contains at least six decimal digits:
2) Rounding
Rounding might happen if the precision of an input number is too high.
Display the table with the following query:
The following table shows that the column can contain at least six decimal digits; the rest is rounded off:
3) Create a Table With Numbers Exceeding the Range
The REAL type only stores 32-bit floating-point numbers. In this example, we input the numbers that exceed the range:
Display the table with the following query:
The final output will only return numbers that match the range.
The DOUBLE PRECISION data type is a 64-bit floating-point number.
1) Create a Table
Here, we are creating a table named numbersdouble with a DOUBLE PRECISION type column.
Display the table with the following query:
The following result shows that the column contains sixteen decimal digits, following the at least 15 decimal digit rule:
2) Rounding
Rounding might happen if the precision of an input number is too high.
Display the table with the following query:
The following result shows that the column can contain at least fifteen decimal digits:
