Skip to content

Instantly share code, notes, and snippets.

@jigar1101
Last active May 26, 2018 17:16
Show Gist options
  • Save jigar1101/7df45bfd9a09a60f90307c1f5836b800 to your computer and use it in GitHub Desktop.
Save jigar1101/7df45bfd9a09a60f90307c1f5836b800 to your computer and use it in GitHub Desktop.
Cassandra Installation and Dummy Keyspace and Table Syntax
Install Cassandra using https://gist.github.com/hkhamm/a9a2b45dd749e5d3b3ae
Post installation - Start the shell for cassandra using
cqlsh localhost
Create Keyspace
create keyspace demo with replication = {'class':'SimpleStrategy', 'replication_factor':1};
Use Keyspace
Use demo;
Create Table
CREATE TABLE emp(
emp_id int PRIMARY KEY,
emp_name text,
emp_city text,
emp_sal varint,
emp_phone varint
);
Insert into table
INSERT INTO emp (emp_id, emp_name, emp_city,
emp_phone, emp_sal) VALUES(1,'A', 'City1', 1244141221, 50000);
INSERT INTO emp (emp_id, emp_name, emp_city,
emp_phone, emp_sal) VALUES(2,'B', 'City2', 1244141222, 50000);
INSERT INTO emp (emp_id, emp_name, emp_city,
emp_phone, emp_sal) VALUES(3,'C', 'City2', 1244141223, 45000);
INSERT INTO emp (emp_id, emp_name, emp_city,
emp_phone, emp_sal) VALUES(4,'D', 'City1', 1244141224, 40000);
INSERT INTO emp (emp_id, emp_name, emp_city,
emp_phone, emp_sal) VALUES(5,'E', 'City1', 1244141225, 40000);
@jigar1101
Copy link
Author

Use gist for Installation Instructions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment