Skip to content

Latest commit

 

History

History
134 lines (102 loc) · 3.02 KB

step2.md

File metadata and controls

134 lines (102 loc) · 3.02 KB
Cassandra Query Language (CQL) ℹ️ For technical support, please contact us via email.
⬅️ Back Step 2 of 2 Next ➡️
Insert and Load Data

✅ Manually insert a single row into the table using an INSERT statement.

video_id added_date title
36b8bac0-6260-11ea-ac4c-87a8af4b7ed0 2020-03-09 Foundations of DataStax Enterprise
Solution
INSERT INTO videos (video_id, added_date, title)
VALUES (36b8bac0-6260-11ea-ac4c-87a8af4b7ed0, '2020-03-09', 'Foundations of DataStax Enterprise');

✅ Use a SELECT statement to retrieve your row from the table.

Solution
SELECT * from videos;

✅ Insert another row into the table.

video_id added_date title
95fe9800-2c2f-11b2-8080-808080808080 2020-01-20 Cassandra Data Modeling
Solution
INSERT INTO videos (video_id, added_date, title) 
VALUES (95fe9800-2c2f-11b2-8080-808080808080, '2020-01-20', 'Cassandra Data Modeling');


✅ Retrieve all rows from the table.

SELECT * from videos;

✅ Delete all previously inserted rows from the table using the TRUNCATE statement and verify that the table is empty.

Solution
TRUNCATE videos;
SELECT * from videos;

✅ Use the COPY command to import data into your videos table.

COPY videos(video_id, added_date, title)
FROM '/workspace/ds201-lab02/data-files/videos.csv'
WITH HEADER=TRUE;

✅ Retrieve all rows from the table to verify that the table loaded correctly.

SELECT * from videos;
⬅️ Back Next ➡️