Last active
December 24, 2015 13:58
-
-
Save natbusa/6808758 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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