Database Reference
In-Depth Information
create keyspace if not exists twitter with
replication = {'class':'SimpleStrategy',
'replication_factor'
: 3};
•
Drop the keyspace
twitter
if it exists:
drop keyspace if exists twitter;
Tables
•
Create a table
users
if it doesn't exist:
create table if not exists users(user_id
text,followers set<text>, tweet_date timestamp,
tweet_body text, first_name text, PRIMARY
KEY(user_id,tweet_date, first_name));
•
Drop the table
users
if it exists:
drop table if exists users;
Indexes
•
Create an index over column
first_name
on the
users
table if it
doesn't exist:
create index if not exists users_first_name_idx
on users(first_name);
•
Drop the index
users_first_name_idx
if it exists:
drop index if exists users_first_name_idx;
Summary
With this chapter we have discussed data modeling and indexing concepts and their use
in Cassandra. To summarize, a few points are worth reiterating: