Database Reference
In-Depth Information
Like the integer types, the floating point and decimal types are always signed. In CQL,
floating point and decimal literals are represented by an optional minus sign, followed by
a series of digits, followed by a period, followed by another series of digits, such as
7152.6846 . You can also write them using exponential notation, like 9.021e14 .
Dates and times
Dates and times can be stored using the timestamp type, which holds date/time data at
millisecond precision. Timestamp literals are enclosed in single quotation marks like
string literals, and take the format 'yyyy-mm-dd HH:mm:ssZ' , for example
'2014-05-18 15:49:31-0400' . There is no type that stores dates without times,
although the time portion of a timestamp literal can be omitted, which defaults the time to
midnight in the given time zone. To represent timestamps with millisecond precision, you
may also use a numeric literal with the number of milliseconds since midnight UTC on
January 1, 1970, for instance, 1400442761830 .
UUIDs
Cassandra has two types that store universally unique identifiers:
• The uuid type stores Version 1 and Version 4 UUIDs
• The timeuuid type stores Version 1 UUIDs, and has special functionality for
conversion between UUIDs and timestamps
Note
A UUID , which is short for universally unique identifier , is essentially a very large
number generated in a specific way, designed to guarantee that the same UUID will never
be generated anywhere in the world at any time. Version 1 UUIDs are generated using a
high-precision timestamp and the generating computer's MAC address; the timestamp can
be extracted from the UUID. Version 4 UUIDs use random or pseudorandom numbers.
CQL uses the canonical representation of UUIDs, which is a sequence of hexadecimal di-
gits broken up in specific places by dashes, in the form 8-4-4-4-12 . A CQL UUID literal
is not surrounded by quotation marks or any other delimiter; for example,
550e8400-e29b-41d4-a716-446655440000 is a valid UUID literal. Most lan-
guages have UUID libraries available that will generate UUIDs and output them in the ca-
nonical format.
Search WWH ::




Custom Search