Your question is SQL Email Null Handling. Start with the requirements and the one table on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Alcon is reviewing the completeness of contact records used for customer communications. Given the t1 table, write a PostgreSQL query that calculates what percentage of records contain an email address.
Treat an email address as present when email is non-null. The result should be safe against division by zero and should report the percentage rounded to two decimal places.
records_with_email / total_records * 100.| Column | Type | Description |
|---|---|---|
| name | VARCHAR(100) | Alcon contact name |
| VARCHAR(255) | Contact email address |