2014-12-13 86 views
0
----------------------------- 
    |ID|  Team  
    ----------------------------- 
    |1 |  {'b'} 
    |2 |  {'c'}  
    |3 |  {'b','c'} 
    ------------------ 

我在卡桑德拉有這張表。我想刪除的table.Since {'b'}所有子集是{'b','c'}{'c'}一個子集的{'b','c'}一個子集,兩行1和2應予以刪除。檢查卡桑德拉的子集

----------------------------- 
    |ID|  Team  
    ----------------------------- 

    |3 |  {'b','c'} 
    ------------------ 

如何在CQL中執行此操作。

回答

0

表:

CREATE TABLE sample (
    id int PRIMARY KEY, 
    team list<text> 
) ; 

CREATE INDEX del_team_idx ON keyspace1.sample (team); 

SELECT * FROM德爾;

id | team 
----+------------ 
    1 |  ['b'] 
    2 | ['c', 'd'] 
    3 | ['b', 'e'] 

輸出

SELECT * FROM sample WHERE team CONTAINS 'e' and team contains 'b' allow filtering; 

id | team 
----+------------ 
    3 | ['b', 'e']