Apache Cassandra

CQL Fundamentals: CREATE, INSERT, SELECT, UPDATE, DELETE

Get comfortable with the basic syntax of the Cassandra Query Language for everyday CRUD operations.

CQL (Cassandra Query Language) is a SQL-like language designed to make Cassandra approachable for developers familiar with relational databases, while hiding much of the underlying distributed storage complexity. Despite the syntactic similarity to SQL, CQL has fundamentally different semantics — there are no JOINs, no subqueries, and WHERE clauses are restricted based on the primary key structure.

CQL looks and feels like ordering from a menu you recognize (SQL-like syntax), but the kitchen behind it (the storage engine) works completely differently — you can only efficiently ask for dishes by their exact table location (partition key), not browse the whole restaurant.

Key Concepts

1
CREATE TABLE defines the schema including partition keys and clustering columns. INSERT and UPDATE are functionally very similar in Cassandra — both are actually upserts under the hood, since Cassandra doesn't distinguish between creating and modifying a row at the storage layer. SELECT queries are restricted to filtering efficiently on the partition key (and optionally clustering columns) unless ALLOW FILTERING is used, which should be treated as a red flag for production queries. DELETE doesn't immediately remove data — it writes a tombstone marker instead.
tombstoneCREATE TABLEINSERTUPDATESELECT
2
CQL supports lightweight transactions (IF NOT EXISTS / IF clauses), TTLs (USING TTL), and batch operations, all of which extend basic CRUD into more specialized patterns used throughout Cassandra applications.
IF NOT EXISTSIFUSING TTL