0
0
dbtdata~10 mins

Store test failures for analysis 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 select all columns from the test failures table.

dbt
SELECT [1] FROM test_failures;
Drag options to blanks, or click blank then click option'
A*
Bid
Cfailure_reason
Dtest_name
Attempts:
3 left
💡 Hint
Common Mistakes
Selecting only one column when all columns are needed.
Using incorrect column names.
2fill in blank
medium

Complete the code to filter test failures where the failure count is greater than 5.

dbt
SELECT * FROM test_failures WHERE failure_count [1] 5;
Drag options to blanks, or click blank then click option'
A<
B<=
C=
D>
Attempts:
3 left
💡 Hint
Common Mistakes
Using < instead of >.
Using = which only matches exactly 5.
3fill in blank
hard

Fix the error in the code to count failures grouped by test name.

dbt
SELECT test_name, COUNT([1]) FROM test_failures GROUP BY test_name;
Drag options to blanks, or click blank then click option'
Afailure_count
B*
Ctest_name
Dfailure_reason
Attempts:
3 left
💡 Hint
Common Mistakes
Counting a column that may have NULLs.
Using COUNT(test_name) which is redundant here.
4fill in blank
hard

Fill both blanks to create a dictionary of test names and their failure counts where count is greater than 10.

dbt
SELECT [1], [2] FROM test_failures WHERE failure_count > 10;
Drag options to blanks, or click blank then click option'
Atest_name
Bfailure_count
Cfailure_reason
Dtest_date
Attempts:
3 left
💡 Hint
Common Mistakes
Selecting columns unrelated to failure counts.
Forgetting to filter by failure count > 10.
5fill in blank
hard

Fill all three blanks to create a summary of failures grouped by test name and ordered by failure count descending.

dbt
SELECT [1], SUM([2]) AS total_failures FROM test_failures GROUP BY [3] ORDER BY total_failures DESC;
Drag options to blanks, or click blank then click option'
Atest_name
Bfailure_count
Dfailure_reason
Attempts:
3 left
💡 Hint
Common Mistakes
Grouping by wrong column.
Summing wrong column.
Not ordering results correctly.