Database Reference
In-Depth Information
Booleans
The boolean type stores simple true/false values. A boolean literal is either true or
false , with no surrounding quotation marks.
Blobs
The blob type stores unstructured binary data. Blobs are a good choice for images, au-
dio, and encrypted data. In CQL, the blob literal is a sequence of hexadecimal digits, pre-
fixed with 0x , for instance, 0x1d4375023013dba2d5f9a . Blob literals are not sur-
rounded by quotation marks.
The purpose of types
Now that you know the full range of types available in Cassandra, you may be wondering
what purpose those types serve. In fact, the type system in Cassandra plays a few roles:
• Types are used for input validation. If you attempt to put a string value in an in-
teger column, for instance, Cassandra will return an error.
• Type information is made available to client libraries; most adapters will return
the results of queries with values represented using the appropriate data type for
the language.
• In some scenarios, rows can be ordered by the value of a certain column. In that
case, the type of the column determines the order of values in the column. For in-
stance, in a text column, '2' is larger than '10' , but in an int column, 10 is
larger than 2 .
Note
You can find a full list of all the CQL data types in the DataStax CQL documentation, at
http://www.datastax.com/documentation/cql/3.1/cql/cql_reference/cql_data_types_c.html .
Now that we've got a firm grasp of how to create a Cassandra table and what options are
available to us when creating columns, it's time to put the table to use.
Search WWH ::




Custom Search