Data types and constraints
Data types and constraints are used to define table columns when creating tables via SQL.
Table of contents
Before you begin
Mapping data types
This table provides mapping between FeatureBase SQL data types and internal data types used by the application for configuring ingestion, API calls, etc.
General data type | FeatureBase SQL data type | Internal data type | Further information |
---|---|---|---|
boolean | bool | bool | |
integer | int | int | |
decimal | decimal | decimal | |
not applicable | id | mutex | Table primary key |
not applicable | idset | set | Used to reduce table rows and make queries more efficient. |
string | string | keyed mutex | |
not applicable | stringset | keyed set | Used to reduce table rows and make queries more efficient. |
timestamp | timestamp | timestamp |
Numeric data types
String data types
Date/Time data types
FeatureBase data types
Constraints
Constraints are applied:
- to data types to modify and optimize how table data is stored and accessed
- when a column is created
Example Create Table statement
create table allcoltypes
(
_id id,
intcol int min 0 max 10000,
boolcol bool,
timestampcol timestamp timeunit 'ms',
decimalcol decimal(2),
stringcol string,
stringsetcol stringset,
stringsetcolq stringsetq timequantum 'YMD' ttl '24h',
idcol id,
idsetcol idset,
idsetcolq idsetq timequantum 'YMD' ttl '24h'
)
comment 'table containing all column types';