Skip to Content
SQL ReferenceOverview

SQL Reference

KalamDB is SQL-first with additional commands for realtime subscriptions, storage lifecycle, topics, and cluster operations.

This chapter is organized by command category so you can jump directly to implementation details.

SQL Categories

CategoryDescription
Namespacescreate/drop/select namespace context
Table DDLcreate/alter/drop tables and views
Data ManipulationINSERT, UPDATE, DELETE, SELECT
Query Data (SELECT & JOIN)query patterns, joins, CTEs, and DataFusion-compatible SELECT usage
SubscriptionsSUBSCRIBE TO, KILL LIVE QUERY
User Managementcreate/alter/drop users and roles
Storagestorage backends, flush, compact, manifests
Storage ID Usagetable-to-storage mapping patterns
Clusterraft and node operations
Backup & Restorenamespace backup/recovery commands
ImpersonationEXECUTE AS USER wrapper syntax
FunctionsKalamDB built-ins plus DataFusion SQL function support

Statement Separator

SELECT 1; SELECT 2;

Quick Example

CREATE NAMESPACE IF NOT EXISTS chat; CREATE TABLE chat.messages ( id BIGINT PRIMARY KEY DEFAULT SNOWFLAKE_ID(), sender TEXT NOT NULL, content TEXT NOT NULL, created_at TIMESTAMP DEFAULT NOW() ) WITH (TYPE = 'USER', FLUSH_POLICY = 'rows:1000'); INSERT INTO chat.messages (sender, content) VALUES ('alice', 'Hello world!'); SELECT * FROM chat.messages ORDER BY created_at DESC LIMIT 20;
Last updated on