How Do You Enter Data into a Cassandra Table?

Problem scenario
You want to insert data into a Cassandra table.  How do you do this?

Solution
Prerequisites

Install and configure Cassandra.  If you do not know how, click on this link and go to "Possible Solution #5" at the bottom to determine the distribution of Linux that you have.

Procedures
1.  Create the table with this command:
CREATE TABLE contint(
   contint_id int PRIMARY KEY,
   contint_name text,
   contint_city text,
   contint_sal varint,
   contint_phone varint
   );

2.  Run this command:
insert into contint (contint_id, contint_city, contint_name, contint_phone) VALUES (1, 'San Francisco', 'Mark Zuckerberg', 4151234567) ;

Leave a comment

Your email address will not be published.