cqlsh

@joekakone

Joseph Konka @joekakone

20/09/2026 · 1 min

ATTENTION: All commands will be saved to history file: /root/.cassandra/cqlsh_history This may include sensitive information such as passwords. To disable history, use --disable-history or set 'disabled = true' in the [history] section of cqlshrc. See https://cassandra.apache.org/doc/latest/tools...

# cqlsh 

ATTENTION: All commands will be saved to history file: /root/.cassandra/cqlsh_history
This may include sensitive information such as passwords.
To disable history, use --disable-history or set 'disabled = true' in the [history] section of cqlshrc.
See https://cassandra.apache.org/doc/latest/tools/cqlsh.html for more information.

Connected to AnalyticsCluster at 127.0.0.1:9042
[cqlsh 6.2.0 | Cassandra 5.0.8 | CQL spec 3.4.7 | Native protocol v5]
Use HELP for help.
cqlsh> -- Create a keyspace
cqlsh> CREATE KEYSPACE IF NOT EXISTS store WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : '1' };
cqlsh> -- Create a table
cqlsh> CREATE TABLE IF NOT EXISTS store.shopping_cart (
   ... userid text PRIMARY KEY,
   ... item_count int,
   ... last_update_timestamp timestamp
   ... );
cqlsh> -- Insert some data
cqlsh> INSERT INTO store.shopping_cart
   ... (userid, item_count, last_update_timestamp)
   ... VALUES ('9876', 2, toTimeStamp(now()));
cqlsh> INSERT INTO store.shopping_cart
   ... (userid, item_count, last_update_timestamp)
   ... VALUES ('1234', 5, toTimeStamp(now()));
cqlsh> SELECT * FROM store.shopping_cart;

 userid | item_count | last_update_timestamp
--------+------------+---------------------------------
   1234 |          5 | 2026-06-15 21:20:34.290000+0000
   9876 |          2 | 2026-06-15 21:20:32.620000+0000

(2 rows)
cqlsh>  INSERT INTO store.shopping_cart (userid, item_count) VALUES ('4567', 20);
cqlsh> SELECT * FROM store.shopping_cart;

 userid | item_count | last_update_timestamp
--------+------------+---------------------------------
   4567 |         20 |                            null
   1234 |          5 | 2026-06-15 21:20:34.290000+0000
   9876 |          2 | 2026-06-15 21:20:32.620000+0000

(3 rows)
cqlsh>

Commentaires

Inscrivez-vous à une formation complète

Voir le catalogue