Difference between NA, Null and NaN, and how to deal with them in SQL
Asked in the Written SQL round stage. Write a PostgreSQL query that classifies raw text values and summarizes their quality by category. Treat SQL NULL, the text markers NA and N/A, the text marker NaN, valid numeric strings, and other text separately.
category, total_values, null_count, na_count, nan_count, valid_numeric_count, invalid_count.category ascending.| Column | Type | Description |
|---|---|---|
| record_idPK | INT | Identifier for the category record |
| category | VARCHAR(50) | Product category |
| Column | Type | Description |
|---|---|---|
| value_idPK | INT | Identifier for the raw value |
| record_id | INT | References categories.record_id |
| raw_value | TEXT | Uncleaned value represented as text |