Data Types Overview
MatrixOne Data types conforms with MySQL Data types definition.
Reference: <https://dev.mysql.com/doc/refman/8.0/en/data-types.html>
Integer Numbers
| Data Type |
Size |
Min Value |
Max Value |
| TINYINT |
1 byte |
-128 |
127 |
| SMALLINT |
2 byte |
-32768 |
32767 |
| INT |
4 byte |
-2147483648 |
2147483647 |
| BIGINT |
8 byte |
-9223372036854775808 |
9223372036854775807 |
| TINYINT UNSIGNED |
1 byte |
0 |
255 |
| SMALLINT UNSIGNED |
2 byte |
0 |
65535 |
| INT UNSIGNED |
4 byte |
0 |
4294967295 |
| BIGINT UNSIGNED |
8 byte |
0 |
18446744073709551615 |
Real Numbers
| Data Type |
Size |
Precision |
Syntax |
| FLOAT32 |
4 byte |
23 bits |
FLOAT |
| FLOAT64 |
8 byte |
53 bits |
DOUBLE |
String Types
| Data Type |
Size |
Syntax |
| String |
24 byte |
CHAR, VARCHAR |
Time and Date Types
| Data Type |
Size |
Resolution |
Min Value |
Max Value |
Precision |
| Date |
4 byte |
day |
1000-01-01 |
9999-12-31 |
YYYY-MM-DD/YYYYMMDD |
| DateTime |
4 byte |
second |
1970-01-01 00:00:00 |
2105-12-31 23:59:59 |
YYYY-MM-DD hh:mm:ss |
Decimal Types(Beta)
| Data Type |
Size |
Precision |
Syntax |
| Decimal64 |
8 byte |
19 digits |
Decimal(N,S), N range(1,18), S range(0,N) |
| Decimal128 |
16 byte |
38 digits |
Decimal(N,S), N range(19,38), S range(0,N) |
Examples
1. //Create a table named "numtable" with 3 attributes of an "int", a "float" and a "double"
2. > create table numtable(id int,fl float, dl double);
4. //Insert a dataset of int, float and double into table "numtable"
5. > insert into numtable values(3,1.234567,1.2345678912345678912);
7. // Create a table named "numtable" with 2 attributes of an "int" and a "float" up to 5 digits in total, of which 3 digits may be after the decimal point.
8. > create table numtable(id int,fl float(5,3));
10. //Insert a dataset of int, float into table "numtable"
11. > insert into numtable values(3,99.123);
13. //Create a table named "numtable" with 2 attributes of an "int" and a "float" up to 23 digits in total.
14. > create table numtable(id int,fl float(23));
16. //Insert a dataset of int, float into table "numtable"
17. > insert into numtable values(1,1.2345678901234567890123456789);
19. //Create a table named "numtable" with 4 attributes of an "unsigned tinyint", an "unsigned smallint", an "unsigned int" and an "unsigned bigint"
20. > create table numtable(a tinyint unsigned, b smallint unsigned, c int unsigned, d bigint unsigned);
22. //Insert a dataset of unsigned (tinyint, smallint, int and bigint) into table "numtable"
23. > insert into numtable values(255,65535,4294967295,18446744073709551615);
25. //Create a table named "names" with 2 attributes of a "varchar" and a "char"
26. > create table names(name varchar(255),age char(255));
28. //Insert a data of "varchar" and "char" into table "names"
29. > insert into names(name, age) values('Abby', '24');
31. //Create a table named "calendar" with 2 attributes of a "date" and a "datetime"
32. > create table calendar(a date, b datetime);
34. //Insert a data of "date" and "datetime" into table "calendar"
35. > insert into calendar(a, b) values('20220202, '2022-02-02 00:10:30');
36. > insert into calendar(a, b) values('2022-02-02, '2022-02-02 00:10:30');
38. //Create a table named "decimalTest" with 2 attribute of a "decimal" and b "decimal"
39. > create table decimalTest(a decimal(6,3), b decimal(24,18));
40. > insert into decimalTest values(123.4567, 123456.1234567891411241355);
41. > select * from decimalTest;
42. +---------+---------------------------+
43. | a | b |
44. +---------+---------------------------+
45. | 123.456 | 123456.123456789141124135 |
46. +---------+---------------------------+