INSERT (CQL)
Inserts a row. In Cassandra, INSERT is an upsert — it creates the row if not exists or replaces it. Use TTL to auto-expire data. IF NOT EXISTS adds a lightweight transaction (slower).
Syntax
cassandra
INSERT INTO table (col1, col2) VALUES (val1, val2) [IF NOT EXISTS] [USING TTL n];Example
cassandra
INSERT INTO users (user_id, name, email)
VALUES (uuid(), 'Alice', 'alice@example.com');
INSERT INTO sessions (token, user_id)
VALUES ('abc123', 42)
USING TTL 3600;