Welcome to the KillrVideo company! KillrVideo hired you to build the latest and greatest video sharing application on the Internet. Your task is to ramp up on the domain and become acquainted with Apache Cassandra. To start, you are looking into creating a table schema and to load some data.
The video metadata is made up of:
Column Name | Date Type |
---|---|
video_id | timeuuid |
added_date | timestamp |
title | text |
✅ Use nodetool
to verify that Cassandra is running (you may need to run this multiple times):
nodetool status
✅ Start the command line tool cqlsh
:
cqlsh
✅ Create a keyspace called killrvideo. Use SimpleStrategy
for the replication class with a replication factor of one.
Solution
CREATE KEYSPACE killrvideo
WITH replication = {
'class':'SimpleStrategy',
'replication_factor': 1
};
✅ Switch to the newly created keyspace with the Use command:
Solution
use killrvideo;
✅ Create a table called videos
with columns video_id
of type TIMEUUID
, added_date
of type TIMESTAMP
and title
of type TEXT
. Designate video_id
as the primary key.
Solution
CREATE TABLE videos (
video_id TIMEUUID,
added_date TIMESTAMP,
title TEXT,
PRIMARY KEY (video_id)
);