CQL for Cassandra 2.x

Using the keyspace qualifier

Sometimes issuing a USE statement to select a keyspace is inconvenient. If you use connection pooling, for example, you have multiple keyspaces to juggle. To simplify tracking multiple keyspaces, use the keyspace qualifier instead of the USE statement. You can specify the keyspace using the keyspace qualifier in these statements:
  • ALTER TABLE
  • CREATE TABLE
  • DELETE
  • INSERT
  • SELECT
  • TRUNCATE
  • UPDATE

Procedure

To specify a table when you are not in the keyspace containing the table, use the name of the keyspace followed by a period, then the table name. For example, Music.playlists.
INSERT INTO Music.playlists (id, title, artist, album) 
  VALUES (62c36092-82a1-3a00-93d1-46196ee77204, 'La Grange', 'ZZ Top', 'Tres Hombres');
Show/hide