Take the 2-minute tour ×

Say I have the following CF with compound Primary Key

     empID int,
     deptID int,
     PRIMARY KEY (deptID, empID));

Because of the compound PK, cassandra will create one row for each dept, and the employee IDs that are members of the department will be stored as columns on that row with the :empID as the column name.

Quesiton #1: can I set a value to that column (e.g the employ name) with CQL3? if so, how?

Question #2: can I see the value of <individual_employ_ID>:empID column - if exists - with CQL3?


share|improve this question
add comment

1 Answer

Question #1: CREATE TABLE dpt ( empID int, deptID int, empName text, PRIMARY KEY (deptID, empID));

Question #2: Please take a look at the examples: http://www.datastax.com/docs/1.1/references/cql/INSERT http://www.datastax.com/docs/1.1/references/cql/UPDATE

share|improve this answer
#1: empName then becomes a new column. I was wondering if I can do something like INSERT INTO dpr (<individual_employ_ID>:empID) VALUES ('employname'); but that's mostly a theoritical question. I just want to know if that's possible and not really having a use case –  balafi Jan 30 '13 at 10:47
add comment

Your Answer


