What is Cassandra's CQL (Cassandra Query Language)?
Answer
CQL (Cassandra Query Language) is Cassandra's SQL-like query interface. It looks like SQL but has important differences reflecting Cassandra's distributed nature. Basic operations: CREATE TABLE users (id UUID PRIMARY KEY, name TEXT, email TEXT);. INSERT INTO users (id, name, email) VALUES (uuid(), 'Alice', 'alice@example.com');. SELECT * FROM users WHERE id = ?;. UPDATE users SET name = 'Bob' WHERE id = ?;. DELETE FROM users WHERE id = ?;. Key differences from SQL: WHERE clauses must include the partition key. No arbitrary JOINs (data must be denormalized). No subqueries. ORDER BY only on clustering columns, in the defined clustering order. ALLOW FILTERING enables inefficient full-scan queries — avoid in production. Batch: atomic writes to the same partition: BEGIN BATCH ... APPLY BATCH. TTL: INSERT ... USING TTL 86400 — auto-delete after 1 day. CQL is accessed via drivers (Java, Python, Node.js) or cqlsh CLI.
Previous
What is RabbitMQ's prefetch and QoS?
Next
What is Cassandra's eventual consistency and how does it handle conflicts?