0
0
dbtdata~10 mins

Why advanced patterns solve complex analytics in dbt - Test Your Understanding

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

Complete the code to select all columns from the 'orders' table.

dbt
SELECT [1] FROM orders;
Drag options to blanks, or click blank then click option'
Aeverything
Ball
C*
Dcolumns
Attempts:
3 left
💡 Hint
Common Mistakes
Using words like 'all' or 'columns' instead of the symbol *.
Leaving the blank empty.
2fill in blank
medium

Complete the code to filter rows where 'status' equals 'completed'.

dbt
SELECT * FROM orders WHERE status [1] 'completed';
Drag options to blanks, or click blank then click option'
A=
B!=
C<>
DLIKE
Attempts:
3 left
💡 Hint
Common Mistakes
Using '!=' or '<>' which mean 'not equal'.
Using LIKE without wildcards.
3fill in blank
hard

Fix the error in the code to correctly join 'orders' and 'customers' on 'customer_id'.

dbt
SELECT orders.id, customers.name FROM orders JOIN customers ON orders.[1] = customers.customer_id;
Drag options to blanks, or click blank then click option'
Aname
Bid
Corder_id
Dcustomer_id
Attempts:
3 left
💡 Hint
Common Mistakes
Joining on 'id' or 'order_id' which do not link the two tables.
Using 'name' which is not an ID column.
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that maps words to their lengths for words longer than 3 characters.

dbt
{word: [1] for word in words if [2]
Drag options to blanks, or click blank then click option'
Alen(word)
Bword > 3
Clen(word) > 3
Dword
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'word > 3' which compares a string to a number.
Not using len() to get word length.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that maps uppercase words to their values if the value is greater than 0.

dbt
result = { [1]: [2] for k, v in data.items() if v [3] 0 }
Drag options to blanks, or click blank then click option'
Ak.upper()
Bv
C>
Dk
Attempts:
3 left
💡 Hint
Common Mistakes
Using k instead of k.upper() for keys.
Using '<' or '=' instead of '>' in the condition.