数据类型 常量 描述
ascii strings 表示ASCII字符串
bigint bigint 表示64位有符号长
blob blobs 表示任意字节
Boolean booleans 表示true或false
counter integers 表示计数器列
decimal integers, floats 表示变量精度十进制
double integers 表示64位IEEE-754浮点
float integers, floats 表示32位IEEE-754浮点
inet strings 表示一个IP地址,IPv4或IPv6
int integers 表示32位有符号整数
text strings 表示UTF8编码的字符串
timestamp integers, strings 表示时间戳
timeuuid uuids 表示类型1 UUID
uuid uuids 表示类型1或类型4 UUID
varchar strings 表示uTF8编码的字符串
varint integers 表示任意精度整数
集合 描述
list 列表是一个或多个有序元素的集合。
map map是键值对的集合。
set 集合是一个或多个元素的集合。
用户自定义:
CREATE TYPE -创建用户定义的数据类型。
ALTER TYPE -修改用户定义的数据类型。
DROP TYPE -删除用户定义的数据类型。
DESCRIBE TYPE -描述用户定义的数据类型。
DESCRIBE TYPES -描述用户定义的数据类型。
cqlsh:test01> CREATE TYPE test01.test_type_01 (
a int,
b text,
c date
);
cqlsh:test01> desc TYPE test_type_01;
CREATE TYPE test01.test_type_01 (
a int,
b text,
c date
);
cqlsh:test01> INSERT INTO t_type_01(id, col1) VALUES (1, {a:1, b: 'a', c: '2019-09-01'});
cqlsh:test01> SELECT * FROM t_type_01 ;
id | col1
----+-------------------------------
1 | {a: 1, b: 'a', c: 2019-09-01}
(1 rows)