Database Reference
In-Depth Information
CQL3
CQL3 provides a SQL-like grammar to access data in a tabular manner. In the previous
section, we saw how the data is actually stored in Cassandra. The CQL representation may
not look like that especially when you use a composite key. In this section, we will discuss
all the features of CQL3.
In this section, a typographic convention is used to indicate syntactic information. Here's
the list of stylization used:
• Capital letter means literal or keyword.
• Curly brackets with the pipe character within them means that you must use at
least one of those keywords in the query. Curly brackets are also used to specify a
map, but they do not have the pipe character in them and they follow JSON nota-
tion.
• Square brackets show options settings.
• Lowercase means variables are to be provided by the developer.
Let's try to interpret an example:
CREATE { KEYSPACE | SCHEMA } [IF NOT EXISTS] keyspace_name
WITH REPLICATION = json_object
[AND DURABLE_WRITES = { true | false }]
The preceding query pattern suggests that after CREATE , we must use either KEYSPACE or
SCHEMA followed by an optional IF NOT EXISTS setting, followed by the name of your
choosing for the keyspace, followed by WITH REPLICATION . After this, you fill in a
JSON object that specifies replication behavior and finally, we may choose to set
DURABLE_WRITES . If we do choose to set DURABLE_WRITES , we must assign it a
true or a false value.
Creating a keyspace
Keyspace is the logical container of tables just like a databaseor a schema in a RDBMS.
Keyspace also holds some of the global settings applied to all the tables in it.
Search WWH ::




Custom Search