Skip to main content
InterviewHubPRO
Section Overview
Q8

Question 8 of 50

Part 1: dbt Core Concepts & Fundamentals (Junior / Entry-Level)

16%
dbt Analytics Engineering (50 Qs)•Part 1: dbt Core Concepts & Fundamentals (Junior / Entry-Level)

What is the difference between Generic Tests and Singular Tests?

junior LevelCode ExampleTypeScript

In Simple Words:

  • Generic Tests: Reusable validation rules defined in YAML on columns (like unique, not_null, or custom generic test macros).
  • Singular Tests: One-off SQL queries saved as .sql files inside the tests/ directory. If the query returns zero rows, the test passes. If it returns one or more rows, the test fails!
sql
-- tests/assert_total_discount_is_positive.sql
-- Fails if any order has a negative discount
SELECT order_id, discount_amount
FROM {{ ref('fct_orders') }}
WHERE discount_amount < 0