· 6 years ago · Mar 15, 2019, 08:56 PM
1CREATE TABLE IF NOT EXISTS test(id uuid PRIMARY KEY, recipient text, message text);
2INSERT INTO test (id, recipient, message) VALUES (7ee055ee-b5dd-4bfd-b184-614d51e268d5, 'felix', 'foo');
3INSERT INTO test (id, recipient, message) VALUES (86c9d632-dc24-4635-8277-c987c78bd242, 'andrew', 'bar');
4
5cqlsh:service_message> DELETE FROM test WHERE id=7ee055ee-b5dd-4bfd-b184-614d51e268d5 IF recipient='felix';
6
7 [applied]
8-----------
9 True
10
11cqlsh:service_message> SELECT * FROM test;
12
13 id | message | recipient
14--------------------------------------+---------+-----------
15 86c9d632-dc24-4635-8277-c987c78bd242 | bar | andrew
16 7ee055ee-b5dd-4bfd-b184-614d51e268d5 | foo | felix
17
18(2 rows)
19
20cqlsh 5.0.1 | Cassandra 3.11.2 | CQL spec 3.4.4 | Native protocol v4
21
22cqlsh> DESCRIBE KEYSPACE service_message
23
24CREATE KEYSPACE service_message WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '3'} AND durable_writes = true;
25
26CREATE TABLE service_message.test (
27 id uuid PRIMARY KEY,
28 message text,
29 recipient text
30) WITH bloom_filter_fp_chance = 0.01
31 AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
32 AND comment = ''
33 AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32', 'min_threshold': '4'}
34 AND compression = {'chunk_length_in_kb': '64', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'}
35 AND crc_check_chance = 1.0
36 AND dclocal_read_repair_chance = 0.1
37 AND default_time_to_live = 0
38 AND gc_grace_seconds = 864000
39 AND max_index_interval = 2048
40 AND memtable_flush_period_in_ms = 0
41 AND min_index_interval = 128
42 AND read_repair_chance = 0.0
43 AND speculative_retry = '99PERCENTILE';