Using an explicit three-part identifier, you can seamlessly query across multiple databases within a single Firebolt account. This capabilty allows you to combine data from different databases using standard SQL joins and unions, providing flexibility while maintaining the organizational benefits of database separation.Documentation Index
Fetch the complete documentation index at: https://docs.firebolt.io/llms.txt
Use this file to discover all available pages before exploring further.
Supported operations
A wide range of operations are supported across databases, including:- Joins and Unions: Combine data from different databases using
JOIN,UNION, and other set operations. - DML: Perform operations like
INSERT INTO ... SELECTandMERGEwhere the source and target tables are in different databases. - CTAS (CREATE TABLE AS SELECT): Create a new table in one database based on a query that selects data from a different database.
- CREATE TABLE CLONE: Create an instant, zero-copy clone of a table from one database into another.
Syntax
The three-part identifier syntax isdatabase_name.schema_name.table_name. In Firebolt, the default schema is public.
Limitations
- Views: A view cannot contain tables from a different database. All tables referenced in a view definition must reside within the same database as the view itself.
- Indexes: An index can only be defined in the same database as its origin table.
Examples
Cross-database JOIN
Imagine you have customer data in asales database and website analytics data in a marketing database. You can join them to see which marketing campaigns are driving sales.
Cross-database UNION
If you have separate databases for different years of sales data, you can union them together to analyze data across all years.Cross-database INSERT AS SELECT
You can archive old data from aproduction database into a separate archive database.
Cross-database CREATE TABLE AS SELECT
Create a new summary table in yourreporting database by aggregating data from the production database.