Nullity and Uniqueness
Validations to check for the presence of null values and the uniqueness of values across rows.
Column must not have null values
Every row in the column must have a non-null value.
Use this when you want to enforce that a column is fully populated — for example, an order_id or email column that must always have a value.
Parameters
| Name | Type | Required | Description |
|---|
| Column | Column | ✅ | The column to validate. |
Example
| Example 1 | Example 2 |
|---|
| Column | customer_email | order_id |
| Result | ❌ Fails | ✅ Passes |
| Reason | Row 2 has a NULL value in customer_email | No null values found in order_id |
Column values must be null
Every row in the column must have a null value.
Use this when you want to assert that a column is intentionally empty — for example, a deleted_at column for records that have not been soft-deleted.
Parameters
| Name | Type | Required | Description |
|---|
| Column | Column | ✅ | The column to validate. |
Example
| order_id | deleted_at | status |
|---|
| 1 | NULL | active |
| 2 | NULL | active |
| 3 | NULL | active |
| Example 1 | Example 2 |
|---|
| Column | status | deleted_at |
| Result | ❌ Fails | ✅ Passes |
| Reason | active in row 1 is not null | All rows in deleted_at are NULL |
Column values must be unique
Every value in the column must be unique across all rows.
Use this when you want to enforce that a column acts as a natural key — for example, order_id, user_id, or any identifier column.
Parameters
| Name | Type | Required | Description |
|---|
| Column | Column | ✅ | The column to validate. |
Example
| order_id | product_id | quantity |
|---|
| 1001 | 42 | 3 |
| 1002 | 17 | 1 |
| 1003 | 42 | 2 |
| Example 1 | Example 2 |
|---|
| Column | product_id | order_id |
| Result | ❌ Fails | ✅ Passes |
| Reason | 42 appears in rows 1 and 3 | All values in order_id are unique |
Set of column values must be unique
The combination of values across two or more columns must be unique for every row.
Use this when no single column is unique on its own, but the combination of columns should be — for example, (user_id, date) in a daily activity table where each user should have at most one record per day.
Parameters
| Name | Type | Required | Description |
|---|
| Column list | Set | ✅ | Two or more column names, comma-separated. For example: user_id, date |
Example
| user_id | date | sessions |
|---|
| 101 | 2026-04-01 | 3 |
| 101 | 2026-04-02 | 1 |
| 102 | 2026-04-01 | 5 |
| 101 | 2026-04-01 | 2 |
| Example 1 | Example 2 |
|---|
| Column list | user_id, date | user_id, sessions |
| Result | ❌ Fails | ✅ Passes |
| Reason | The combination (101, 2026-04-01) appears in rows 1 and 4 | All combinations of user_id and sessions are unique |
Column values must be unique in the same row
The values across the specified columns must be unique within each individual row.
Use this when you need to ensure that no two columns in the same row share the same value — for example, a survey table where first_choice and second_choice must always be different options.
Parameters
| Name | Type | Required | Description |
|---|
| Column list | Set | ✅ | Two or more column names, comma-separated. For example: first_choice, second_choice |
Example
| response_id | first_choice | second_choice | third_choice |
|---|
| 1 | A | B | C |
| 2 | A | A | C |
| 3 | B | C | A |
| Example 1 | Example 2 |
|---|
| Column list | first_choice, second_choice | first_choice, third_choice |
| Result | ❌ Fails | ✅ Passes |
| Reason | Row 2 has the same value A in both first_choice and second_choice | No row shares the same value across first_choice and third_choice |