Haz clic en un nodo para ver detalles y dependencias
SEEDSSTAGINGINTERMEDIATEMARTS
seedraw_customersseedraw_productsseedraw_orders
viewstg_customersviewstg_productsviewstg_orders
viewint_orders_enriched
tablefct_orderstabledim_customers
Staging
stg_customersview
stg_productsview
stg_ordersview
Intermediate
int_orders_enrichedview
Marts
fct_orderstable
dim_customerstable
stg_customers.sql
models/staging/
SELECT order_id, order_date, customer_name, product_name, product_category, quantity, gross_revenue, net_revenue, gross_profit, margin_pct, status, channel FROM marts.fct_orders ORDER BY order_id LIMIT 15
order_id▲
order_date▲
customer_name▲
product_name▲
category▲
qty▲
gross_rev▲
net_rev▲
profit▲
margin%▲
status▲
channel▲
SELECT customer_id, full_name, country, segment, total_orders, completed_orders, lifetime_revenue, lifetime_profit, avg_order_value, value_tier FROM marts.dim_customers ORDER BY lifetime_revenue DESC
id▲
full_name▲
country▲
segment▲
orders▲
completed▲
lifetime_rev▲
lifetime_profit▲
avg_order▲
value_tier▲
SELECT strftime(order_month,’%Y-%m’) as month, count(*) as orders, sum(quantity) as units, round(sum(net_revenue),2) as revenue, round(sum(gross_profit),2) as profit, round(avg(margin_pct),1) as avg_margin FROM marts.fct_orders WHERE is_completed GROUP BY 1 ORDER BY 1
month▲
orders▲
units▲
revenue▲
profit▲
avg_margin%▲
SELECT product_category, count(*) as orders, round(sum(net_revenue),2) as revenue, round(sum(gross_profit),2) as profit, round(avg(margin_pct),1) as avg_margin FROM marts.fct_orders WHERE is_completed GROUP BY 1 ORDER BY revenue DESC
category▲
orders▲
revenue▲
profit▲
avg_margin%▲
SELECT customer_country, count(*) as orders, round(sum(net_revenue),2) as revenue, round(avg(margin_pct),1) as avg_margin FROM marts.fct_orders WHERE is_completed GROUP BY 1 ORDER BY revenue DESC