Write a SQL query to extract the domain name from a column containing raw email addresses.
Use the email_records table and handle leading or trailing whitespace, mixed-case addresses, NULL values, and malformed entries.
id, raw_email, and domain_name.id ascending.| Column | Type | Description |
|---|---|---|
| idPK | INT | Unique email record identifier |
| raw_email | VARCHAR(255) | Raw email address, which may contain whitespace, mixed case, or invalid values |