Skip to content

SQL Pattern Matching

The SQL Pattern Matching rule ensures values in a dataset match specified text patterns using SQL LIKE syntax.
This rule is commonly used to:

  • Identify and validate values like email domains, phone number formats, or prefixes.
  • Enforce standardized value formats within columns for consistency.

Example Usage:
Check if email addresses belong to Gmail (%@gmail.com) or verify if customer names start with ‘A’.


Configuration Fields

Rule-Specific Configuration

Field NameDescriptionRequiredData Type / Options
SQL Like PatternSQL LIKE pattern to apply for value matching (use % and _)YesString

Success Criteria Configuration

This section defines how the rule’s outcome is measured against expected thresholds.

Field NameDescriptionRequiredOptions / Format
OperatorComparison operation for the result countYesGreaterThan, LessThan, EqualTo, Between
Threshold ValueValue for comparison (for GreaterThan, LessThan, EqualTo)ConditionalNumber
Threshold MinMinimum value (for Between operator)ConditionalNumber
Threshold MaxMaximum value (for Between operator)ConditionalNumber
Is PercentageWhether the threshold represents a percentage or an absolute countNotrue / false (default: false)
Allow NullsWhether null values are considered validNotrue / false (default: false)
Check For MatchWhen false, validates for negation of the conditionNotrue / false (default: true)

Sample Input Data

IDEmailName
1alice@gmail.comAlice
2bob@yahoo.comBob
3charlie@gmail.comCharlie
4dave@hotmail.comDave
5eve@gmail.comEve

Sample Configurations

Example 1: Email Domain Check

Configuration FieldValue
ColumnEmail
SQL Like Pattern%@gmail.com
OperatorGreaterThan
Threshold Value50
Is Percentagetrue
Allow Nullsfalse
Check For Matchtrue

Explanation:
Validates that more than 50% of emails belong to Gmail.


Example 2: Name Prefix Check

Configuration FieldValue
ColumnName
SQL Like PatternA%
OperatorGreaterThan
Threshold Value0
Is Percentagefalse
Allow Nullsfalse
Check For Matchtrue

Explanation:
Validates that at least one name starts with ‘A’.


Sample Output

Column NameRule NameSuccess CountFailure CountNull CountWithin Threshold
EmailSQL Pattern Matching320Yes
NameSQL Pattern Matching140Yes