Skip to content

Instantly share code, notes, and snippets.

@natbusa
Last active December 24, 2015 13:58
Show Gist options
  • Save natbusa/6808758 to your computer and use it in GitHub Desktop.
Save natbusa/6808758 to your computer and use it in GitHub Desktop.
DROP TABLE followers;
CREATE TABLE followers (
followed_id text,
follower_id text,
created timestamp,
messages_count int,
likes_count int,
PRIMARY KEY (followed_id, follower_id)
);
cqlsh:test> select * from followers where followed_id='123' and follower_id>'500';
followed_id | follower_id | created | likes_count | messages_count
-------------+-------------+--------------------------+-------------+----------------
123 | 567 | 2011-02-03 05:05:00+0100 | 5 | 2
123 | 890 | 2011-08-21 20:05:00+0200 | 2 | 1
insert into followers (followed_id,follower_id , created, messages_count, likes_count) values ('123','567','2011-02-03T04:05:00+0000',2,5) ;
insert into followers (followed_id,follower_id, created, messages_count, likes_count) values ('123','890','2011-08-21T18:05:00+0000',1,2) ;
insert into followers (followed_id,follower_id, created, messages_count, likes_count) values ('222','567','2012-03-03T07:05:00+0000',3,0) ;
cqlsh:test> select * from followers;
followed_id | follower_id | created | likes_count | messages_count
-------------+-------------+--------------------------+-------------+----------------
123 | 567 | 2011-02-03 05:05:00+0100 | 5 | 2
123 | 890 | 2011-08-21 20:05:00+0200 | 2 | 1
222 | 567 | 2012-03-03 08:05:00+0100 | 0 | 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment