May 17, 2021 Cassandra
CQL provides a rich set of built-in data types, including collection types. I n addition to these data types, users can create their own custom data types. The following table provides a list of the built-in data types available in CQL.
The data type | Constant | Describe |
---|---|---|
Ascii | strings | Represents the ASCII string |
bigint | bigint | Indicates that 64 bits are signed long |
Blob | blobs | Represents any byte |
Boolean | booleans | Represents true or false |
counter | integers | Represents a counter column |
decimal | integers, floats | Represents a variable precision heteth |
double | integers | Represents a 64-bit IEEE-754 floating point |
float | integers, floats | Represents a 32-bit IEEE-754 floating point |
inet | strings | Represents an IP address, IPv4 or IPv6 |
Int | integers | Represents a 32-bit signed integer |
text | strings | A string that represents UTC8 encoding |
timestamp | integers, strings | Represents a timestamp |
timeuuid | uuids | Represents type 1 UUID |
Uuid | uuids | Represents type 1 or type 4 |
Uuid | ||
varchar | strings | A string that represents uTF8 encoding |
varint | integers | Represents any precision integer |
The Cassandra query language also provides a collection data type. The following table provides a list of the collections available in CQL.
Collection | Describe |
---|---|
list | A list is a collection of one or more ordered elements. |
map | A map is a collection of key value pairs. |
set | A collection is a collection of one or more elements. |
Cqlsh provides users with the tools to create their own data types. The commands used to process user-defined data types are given below.
CREATE TYPE - Create user-defined data types.
ALTER TYPE - Modify user-defined data types.
DROP TYPE - Delete user-defined data types.
DESCRIBE TYPE - Describes user-defined data types.
DESCRIBE TYPES - Describes user-defined data types.