Skip to content

Latest commit

 

History

History
62 lines (52 loc) · 1.93 KB

step4-cassandra.md

File metadata and controls

62 lines (52 loc) · 1.93 KB
Exercise 2.3: Denormalizing ℹ️ For technical support, please contact us via email.
⬅️ Back Step 4 of 4 Next ➡️
Create a "videos_by_genre" table

✅ Create table videos_by_genre:

CREATE TABLE videos_by_genre ( 
  genre TEXT,
  added_date TIMESTAMP, 
  video_id TIMEUUID, 
  description TEXT,
  encoding FROZEN<video_encoding>, 
  tags SET<TEXT>,
  title TEXT,
  user_id UUID,
  PRIMARY KEY ((genre), added_date, video_id)
) WITH CLUSTERING ORDER BY (added_date DESC, video_id ASC);

✅ Load videos_by_genre.csv into the videos_by_genre table using the COPY command:

COPY videos_by_genre (genre,added_date,video_id,description,encoding,tags,title,user_id) 
FROM 'assets/videos_by_genre.csv' WITH HEADER = true;

✅ Run a query to retrieve the video information for a particular genre:

SELECT * FROM videos_by_genre WHERE genre = 'Musical' LIMIT 10;
⬅️ Back Next ➡️