Created
November 21, 2015 15:58
-
-
Save brianwawok/527e223e96203d10c951 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
create table website_hits( | |
full_url TEXT, | |
hit_date TIMESTAMP, | |
website_hit_id UUID, | |
PRIMARY KEY(full_url, hit_date, website_hit_id ) | |
) WITH CLUSTERING ORDER BY (hit_date DESC); | |
insert into website_hits(full_url, hit_date, website_hit_id) values('www.foo.com', dateof(now()), uuid()); | |
insert into website_hits(full_url, hit_date, website_hit_id) values('www.bar.com', dateof(now()), uuid()); | |
insert into website_hits(full_url, hit_date, website_hit_id) values('www.bar.com', dateof(now()), uuid()); | |
insert into website_hits(full_url, hit_date, website_hit_id) values('www.foo.com', dateof(now()), uuid()); | |
cqlsh:test> select distinct full_url from website_hits; | |
full_url | |
------------- | |
www.bar.com | |
www.foo.com | |
(2 rows) | |
cqlsh:test> select count(*) from website_hits where full_url = 'www.foo.com'; | |
count | |
------- | |
2 | |
(1 rows) | |
cqlsh:test> select count(*) from website_hits where full_url = 'www.foo.com' and hit_date > '2015-01-01'; | |
count | |
------- | |
2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment