You are given a dataset with missing values; how do you proceed?
Write a SQL query that profiles missing values in NHS activity records by site. Include sites with no activity records and treat missing site names as Unnamed site.
site_code, site_name, total_records, missing counts for each activity field, missing_value_count, and missing_value_rate_pct.site_code ascending.site_code, site_name, total_records, missing_activity_date, missing_completed_attendances, missing_cancellations, missing_postcode, missing_value_count, missing_value_rate_pct.total_records and missing-field counts, excluding the placeholder row for sites with no activity.missing_value_count as the sum of the four activity-field missing counts.missing_value_rate_pct as missing values divided by total_records * 4, multiplied by 100.missing_value_rate_pct to two decimal places and return 0.00 when total_records is zero.site_code and site_name, allowing multiple rows with the same site_code when names differ.| Column | Type | Description |
|---|---|---|
| site_idPK | INTEGER | Unique NHS site identifier |
| site_code | VARCHAR(20) | Short NHS site code |
| site_name | VARCHAR(100) | Display name of the NHS site |
| Column | Type | Description |
|---|---|---|
| activity_idPK | INTEGER | Unique activity record identifier |
| site_id | INTEGER | NHS site associated with the activity |
| activity_date | DATE | Date of the recorded activity |
| completed_attendances | INTEGER | Number of completed attendances |
| cancellations | INTEGER | Number of cancellations |
| postcode | VARCHAR(30) | Postcode associated with the activity |