SQL Engine
SQL Engine
Dialect
Altertable uses the DuckDB SQL dialect for all queries. If you're familiar with PostgreSQL or SQLite, you'll feel right at home.
Example query:
SELECTuser_id,COUNT(*) AS sessionsFROM altertable.main.web_sessionsWHERE started_at >= date_trunc('week', now())GROUP BY user_idORDER BY sessions DESCLIMIT 10;
For complete syntax reference, see the DuckDB SQL Documentation.
Data Types
Altertable supports the same data types as DuckDB, including:
- Numeric types:
INTEGER,BIGINT,DOUBLE,DECIMAL,HUGEINT - Text types:
VARCHAR,TEXT - Temporal types:
DATE,TIMESTAMP,TIMESTAMPTZ,TIME,INTERVAL - Binary types:
BLOB,BITSTRING - Boolean type:
BOOLEAN - Nested types:
ARRAY,LIST,MAP,STRUCT,UNION - Special types:
UUID,JSON
For a complete list of supported data types and their specifications, see the DuckDB Data Types Overview.
Federated Queries
Connect multiple data sources — from BigQuery to Postgres databases — within the same SQL namespace. Query and join across them seamlessly:
SELECTu.email,b.total_revenueFROM pg_production.users uJOIN bigquery.revenue bON u.id = b.user_id;
The engine handles cross-database federation automatically, optimizing query execution across your connected sources.