Describe your experience with ETL, data cleaning, and SQL.
Write a SQL query that separates valid staged customer events from invalid ones, based on the rules below. Use the provided tables to identify which events can be loaded into the target model and which should be rejected.
event_id, customer_email, event_date, status, rejection_reasonevent_id ascendingcustomer_email by trimming whitespace and converting it to lowercase, preserving NULL as NULL.invalid with rejection_reason unknown customer when no customer matches the normalized email.NULL or blank customer_email as invalid with reason missing email.NULL event_date as invalid with reason missing event date.NULL or nonpositive amount as invalid with reason invalid amount.NULL for rejection_reason when status is valid, and prioritize unknown customer before other rejection reasons.| Column | Type | Description |
|---|---|---|
| customer_idPK | INT | Unique customer identifier |
| VARCHAR(255) | Customer email address | |
| status | VARCHAR(20) | Customer account status |
| Column | Type | Description |
|---|---|---|
| event_idPK | INT | Staged event identifier |
| customer_email | VARCHAR(255) | Email captured in the staging feed |
| event_date | DATE | Event date from the source system |
| amount | NUMERIC(10,2) | Event amount |