0
0
dbtdata~10 mins

Staging, intermediate, and marts pattern in dbt - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to define a staging model that selects all columns from the raw source table.

dbt
select * from [1]
Drag options to blanks, or click blank then click option'
Araw.customers
Bintermediate.customers
Cmarts.customers
Danalytics.customers
Attempts:
3 left
💡 Hint
Common Mistakes
Using intermediate or marts tables in staging models.
Referencing analytics schema instead of raw.
2fill in blank
medium

Complete the code to create an intermediate model that joins staging customers with staging orders.

dbt
select c.customer_id, c.name, o.order_id, o.order_date
from [1] c
join [2] o on c.customer_id = o.customer_id
Drag options to blanks, or click blank then click option'
Aintermediate.customers
Bstaging.orders
Cstaging.customers
Draw.orders
Attempts:
3 left
💡 Hint
Common Mistakes
Using intermediate or raw tables for customers in this join.
Mixing staging and intermediate layers incorrectly.
3fill in blank
hard

Fix the error in the intermediate model code by choosing the correct table for orders.

dbt
select c.customer_id, c.name, o.order_id, o.order_date
from staging.customers c
join [1] o on c.customer_id = o.customer_id
Drag options to blanks, or click blank then click option'
Araw.orders
Banalytics.orders
Cmarts.orders
Dstaging.orders
Attempts:
3 left
💡 Hint
Common Mistakes
Joining raw.orders directly in intermediate models.
Using marts or analytics tables too early.
4fill in blank
hard

Fill both blanks to create a mart model that aggregates total sales per customer from the intermediate orders table.

dbt
select customer_id, sum([1]) as total_sales
from [2]
group by customer_id
Drag options to blanks, or click blank then click option'
Aorder_amount
Bintermediate.orders
Cstaging.orders
Draw.orders
Attempts:
3 left
💡 Hint
Common Mistakes
Using staging or raw tables directly in marts.
Summing wrong columns like order_id.
5fill in blank
hard

Fill all three blanks to create a mart model that calculates average order value per customer using intermediate data.

dbt
select [1], avg([2]) as avg_order_value
from [3]
group by [1]
Drag options to blanks, or click blank then click option'
Acustomer_id
Border_amount
Cintermediate.orders
Dstaging.customers
Attempts:
3 left
💡 Hint
Common Mistakes
Using staging tables in marts.
Grouping by wrong columns.