Knowledge Base
NORMALIZE_EMAIL
Email Normalization in NQL
Overview
This reference provides a concise guide to using the NORMALIZE_EMAIL
User-Defined Function (UDF) in NQL to standardize email addresses for consistent data processing.
Function: NORMALIZE_EMAIL
Arguments
- email (string): The email address to normalize.
What It Does
The NORMALIZE_EMAIL
UDF standardizes email addresses by:
- Converting the email address to lowercase.
- Removing leading and trailing whitespace.
- For Gmail addresses:
- Removing all periods (
.
) in the local part. - Removing everything after a
+
symbol in the local part.
- Removing all periods (
Example
NQL Query
SELECT "EMAIL",
NORMALIZE_EMAIL("EMAIL") AS "NORMALIZED_EMAIL"
FROM company_data.test_normalize_email;
Expected Output
Original Email | Normalized Email |
---|---|
User.Name+promo@gmail.com | username@gmail.com |
admin@Example.com | admin@example.com |
JOHNDOE@Yahoo.COM | johndoe@yahoo.com |
user.name+news@gmail.com | username@gmail.com |
alice@domain.com | alice@domain.com |
Key Benefits
- Consistency: Normalized email addresses ensure consistent results in operations like hashing and deduplication.
- Data Cleanliness: Removes extraneous formatting variations.
Notes
- Use the NQL Editor to validate your query before execution.
- This function is optimized for Gmail-specific address formats but works for all email domains.