Skip to content

Instantly share code, notes, and snippets.

@natbusa
Created December 12, 2013 13:17
Show Gist options
  • Save natbusa/7927797 to your computer and use it in GitHub Desktop.
Save natbusa/7927797 to your computer and use it in GitHub Desktop.
Little cassandra table
CREATE KEYSPACE ks WITH replication = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 } ;
create table ks.tb (
a1 TEXT,
b1 TEXT,
b2 INT,
d INT,
v INT,
PRIMARY KEY ( a1, b1, b2 )
);
INSERT INTO ks.tb (a1,b1,b2,d,v) VALUES ('abc','def',2,1,12);
INSERT INTO ks.tb (a1,b1,b2,d,v) VALUES ('abc','def',2,2,13);
INSERT INTO ks.tb (a1,b1,b2,d,v) VALUES ('abc','def',3,3,14);
INSERT INTO ks.tb (a1,b1,b2,d,v) VALUES ('abc','def',5,4,15);
SELECT b2,v,d FROM ks.tb WHERE a1='abc' and b1='def' and b2>2 LIMIT 2;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment