📅  最后修改于: 2020-12-02 06:22:09             🧑  作者: Mango
CQL提供了一组丰富的内置数据类型,包括集合类型。除了这些数据类型,用户还可以创建自己的自定义数据类型。下表提供了CQL中可用的内置数据类型的列表。
Data Type | Constants | Description |
---|---|---|
ascii | strings | Represents ASCII character string |
bigint | bigint | Represents 64-bit signed long |
blob | blobs | Represents arbitrary bytes |
Boolean | booleans | Represents true or false |
counter | integers | Represents counter column |
decimal | integers, floats | Represents variable-precision decimal |
double | integers | Represents 64-bit IEEE-754 floating point |
float | integers, floats | Represents 32-bit IEEE-754 floating point |
inet | strings | Represents an IP address, IPv4 or IPv6 |
int | integers | Represents 32-bit signed int |
text | strings | Represents UTF8 encoded string |
timestamp | integers, strings | Represents a timestamp |
timeuuid | uuids | Represents type 1 UUID |
uuid | uuids | Represents type 1 or type 4 |
UUID | ||
varchar | strings | Represents uTF8 encoded string |
varint | integers | Represents arbitrary-precision integer |
Cassandra查询语言还提供了集合数据类型。下表提供了CQL中可用的集合的列表。
Collection | Description |
---|---|
list | A list is a collection of one or more ordered elements. |
map | A map is a collection of key-value pairs. |
set | A set is a collection of one or more elements. |
Cqlsh为用户提供了创建自己的数据类型的便利。下面给出的是处理用户定义的数据类型时使用的命令。
创建类型-创建用户定义的数据类型。
ALTER TYPE-修改用户定义的数据类型。
DROP TYPE-删除用户定义的数据类型。
DESCRIBE TYPE-描述用户定义的数据类型。
DESCRIBE TYPES-描述用户定义的数据类型。