Cassandra之中一共包含下面5种Key:
| 1 2 3 4 5 6 7 8 9 10 11 12 | -- 一列 create table stackoverflow (       key text PRIMARY KEY,       data text       ); -- 复合列 create table stackoverflow (       key_part_one text,       key_part_two int,       data text,       PRIMARY KEY(key_part_one, key_part_two)         ); | 
Clustering Key : 主要用于进行Range Query. 并且使用的时候需要按照建表顺序进行提供信息!
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | -- 创建表 -- 注意state 这个field CREATE TABLE users (   mainland text,   state text,   uid int,   name text,   zip int,   PRIMARY KEY ((mainland), state, uid) ) -- 插入一些值 insert into users (mainland, state, uid, name, zip)     VALUES ( ‘northamerica‘, ‘washington‘, 1, ‘john‘, 98100); xxxx more insert into users (mainland, state, uid, name, zip)     VALUES ( ‘southamerica‘, ‘argentina‘, 6, ‘alex‘, 10840); | 
| 1 | select * from users where mainland = ‘northamerica‘ and state > ‘ca‘ and state < ‘ny‘; | 
Cassandra key说明——Cassandra 整体数据可以理解成一个巨大的嵌套的Map Map<RowKey, SortedMap<ColumnKey, ColumnValue>>
原文:http://www.cnblogs.com/bonelee/p/6279047.html