DML example, insert into user_score_v3(name, highscore, x,y,z) values ('abc', 299.76, 1001, '*', '*'); ...
2012/4/26 Data Craftsman <database.crafts...@gmail.com>: > Data model: > > REM CQL 3.0 > ---- > > $> cqlsh --cql3 > > drop COLUMNFAMILY user_score_v3; > > CREATE COLUMNFAMILY user_score_v3 > (name varchar, > highscore float, > x int, > y varchar, > z varchar, > PRIMARY KEY (name, highscore) > ); > > DML is as usual, as commom, as RDBMS SQL. > > Query: > > Top 3, > > SELECT name, highscore, x,y,z FROM user_score_v3 where name='abc' > ORDER BY highscore desc > LIMIT 3; > > You may try Reversed Comparators, see > http://thelastpickle.com/2011/10/03/Reverse-Comparators/ > > Help this is helpful. > > Thank, > Charlie | DBA > > > On Thu, Apr 26, 2012 at 12:34 PM, Ed Jone <edjo...@gmail.com> wrote: >> Hello, >> >> I am new to cassandra and was hoping if someone can tell me if the following >> is possible. >> >> >> Given I have a columnfamily with a list of users in each Row. >> >> Each user has the properties: name, highscore, x, y, z. >> >> I want to use name as the column key, but I want the columns to be sorted by >> highscore (always). >> >> The only reads would be to get the top N users by highscore in a given row. >> I thought about adding the weight to the name as the key (eg: >> 299.76-johnsmith) but then I would not be able to update a given user. >> >> This was not possible in the past, but I am not familiar, with the newer >> cassandra versions. > > > -- > Thanks, > > Charlie (@mujiang) 一个 木匠 > ======= > Data Architect Developer > http://mujiang.blogspot.com -- -- Thanks, Charlie (@mujiang) 一个 木匠 ======= Data Architect Developer http://mujiang.blogspot.com