STRING data type
DDL Syntax
STRING
Arguments
Argument | Description |
---|---|
STRING | Used for STRING, CHAR and VARCHAR data. |
Additional information
The STRING data type:
- has a
keyed mutex
internal data type - works best when:
- Looking for discrete values,
group by
where cardinality is low
Use single quotes to contain string values in INSERT, REPLACE or SELECT statements.
If data has high cardinality:
- performance can decrease
- storage will increase
Examples
CREATE products and sales tables and columns with string datatypes
create table products
(_id id, prodlist string, price decimal(2) stock int);
create table services
(_id id, servicelist string, price decimal(2));
SELECT FROM string column
SELECT * FROM products WHERE prodlist LIKE '%pen%';
CREATE TABLE with all data types
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';