Skip to main content
SQL โ€ข LESSON 123

Data Quality Check

How can we detect invalid or corrupt salary records?

Advancedโฑ 3 Minutesโญ 1360 XP
๐Ÿค” THE QUESTION

How can we detect invalid or corrupt salary records?

๐Ÿ’ก WHAT IS IT?

Checking for NULL or negative values identifies corrupt source data before reporting.

๐ŸŽฏ WHAT IS IT USED FOR?

Automated dbt test assertions, ingestion boundary validation, preventing corrupted financial reports.

๐Ÿ’ป EXAMPLE
SELECT
COUNT(*) AS invalid_salary_count
FROM employees
WHERE salary IS NULL
OR salary < 0;

๐ŸŽฏ Mission Objectives

Practice typing production-grade SQL code for Data Quality Check.

  • โœ“ Data validation rule
  • โœ“ Negative value check
  • โœ“ Anomaly detection
  • โœ“ Data pipeline testing