Complete the code to define a dbt model that selects all columns from the source table.
select * from [1]
In dbt, source() is used to refer to raw source tables defined in the sources.yml file.
Complete the code to create a dbt model that references another model named 'customer_orders'.
select * from [1]
The ref() function in dbt is used to reference other models within the project.
Fix the error in the dbt model code to correctly filter customers with more than 5 orders.
select customer_id, count(order_id) as order_count from [1] group by customer_id having order_count > 5
To reference another dbt model, use ref(). This allows dbt to manage dependencies and build order.
Fill both blanks to create a dbt model that builds a dictionary of customer names and their total amounts, filtering for customers with more than 3 orders.
select customer_name, sum(order_amount) as total_amount from [1] where order_count [2] 3 group by customer_name
Use ref() to reference the model and the greater than operator > to filter customers with more than 3 orders.
Fill all three blanks to create a dbt model that selects customer_id, total orders, and filters for customers with order counts less than 10.
select [1], count([2]) as total_orders from [3] group by [1] having total_orders < 10
We select customer_id, count order_id from the orders model referenced by ref().