How do you handle NULL values in SQL?
Asked in the Recruiter Screen stage. Write a SQL query using the provided tables to produce customer-level trip metrics for January 2025. Preserve customers with no qualifying trips, distinguish missing fares from zero fares, and exclude trips outside the reporting period or without a usable trip date.
customer_id, customer_name, total_trips, trips_with_fare, total_fare, average_fare, and latest_trip_date.total_fare should be zero when no fare is available; average_fare should remain NULL when no non-NULL fare exists.customer_id ascending.| Column | Type | Description |
|---|---|---|
| customer_idPK | INT | Unique customer identifier |
| customer_name | VARCHAR(100) | Customer display name |
| Column | Type | Description |
|---|---|---|
| trip_idPK | INT | Unique trip identifier |
| customer_id | INT | Customer associated with the trip |
| trip_date | DATE | Date on which the trip occurred |
| fare_amount | NUMERIC(10,2) | Recorded fare amount |