Database Reference
In-Depth Information
values('imvivek','2013-12-31','good bye
2013','vivek');
insert into
users(user_id,tweet_date,tweet_body,first_name)
values('imvivek','2014-01-01','welcome
2014','vivek');
insert into
users(user_id,tweet_date,tweet_body,first_name)
values('imvivek','2014-01-04','Working on
Cassandra book on weekend','Vivs');
3.
Add index over
first_name
and retrieve records with the first
name
vivek
:
create index on user(first_name);
select * from users where first_name =
'vivek';
Figure 3-17
shows the result of fetching data by clustering the
column
first_name
after secondary indexes enabled.
Figure 3-17
.
Fetch records after enabling secondary indexes over clustering the column
first_name
Conditional DDL
With Cassandra 2.x it is now possible to perform conditional DDL operations over key-
space, table, and indexes. A conditional DDL allows a user to validate whether a ques-
tioned keyspace, column family, or index is present or not. Let's look at a few ex-
amples of how this works.
Keyspaces
•
Create the keyspace
twitter
if it doesn't exist: