Demo · view as
postgres
crm
customers
id bigint
name varchar
region varchar
email varchar
phone varchar
leads
id bigint
name varchar
source varchar
created_at timestamp(3)
snowflake
sales
orders
id bigint
customer_id bigint
total decimal(12,2)
ordered_at timestamp(3)
order_items
id bigint
order_id bigint
sku varchar
qty integer
mysql
app
events
id bigint
user_id bigint
event_type varchar
ts timestamp(3)
sessions
id bigint
user_id bigint
started_at timestamp(3)
iceberg
analytics
daily_revenue
day date
region varchar
revenue decimal(14,2)
Ctrl+Enter to run · Tab to indent
SELECT c.name, c.region, c.email,
SUM(o.total) AS lifetime_value
FROM postgres.crm.customers c
JOIN snowflake.sales.orders o ON o.customer_id = c.id
GROUP BY 1, 2, 3
ORDER BY lifetime_value DESC; Results
Run a query to see results
Running query…
| # | name | region | lifetime_value | |
|---|---|---|---|---|
| 1 | Acme Corp | US-East | ops@acme.com | 48200.00 |
| 2 | Globex | EU-West | data@globex.eu | 36900.00 |
| 3 | Initech | US-West | bi@initech.com | 21400.00 |
| 4 | Umbrella | EU-North | it@umbrella.eu | 12750.00 |
| 5 | Soylent | US-South | ops@soylent.io | 9300.00 |
| 1 | Globex | EU-West | NULL masked | 36900.00 |
| 2 | Umbrella | EU-North | NULL masked | 12750.00 |