

You can also write a validity rule to test the integrity of the primary key column. Note that the regular expression used in this query is just an example and you may need to modify it to match the format of phone numbers in your data. WHERE column_name IS NOT NULL AND column_name NOT LIKE ‘(’ When you have specific format requirements like telephone numbers or social security numbers, write a rule to check whether the data in that column conforms to or violates that format.įor example, to make sure all the data conforms to the phone number format (XXX) XXX-XXXX you can use this rule: SELECT COUNT(*) as num_invalid_numbers If the count is greater than 0, then there are one or more invalid codes in the column. If the count is 0, then all of the country codes in the column are valid according to ISO 3166-1 alpha-2.

WHERE column_name IS NOT NULL AND column_name NOT IN ( Here’s an example: SELECT COUNT(*) as num_invalid_codes You can then compare the country code in your column to the list of valid codes in the lookup table. One way to check if a value is valid is to create a lookup table that contains a list of all valid country codes. This is useful when you only want known values, such as two-letter country codes. These rules are often developed after profiling the data and seeing where it breaks. This blog post will cover the most common quality and business rules, give examples of how to set them up, and you’ll learn how to automatically check for data validity with Monte Carlo. Since the quality of insights you derive from data depends on the validity of that data, deep thought should go into your validation rules. Validity is one of the six dimensions of data quality. They ensure compliance to expected conditions in this case to make sure your password is hard to guess.ĭata validity simply means how well does data meet certain criteria, often evolving from analysis of prior data as relationships and issues are revealed. The annoying red notices you get when you sign up for something online saying things like “your password must contain at least one letter, one number, and one special character” are examples of data validity rules in action.
