Write a SQL query to compare defect counts before and after a data correction.
Assume each correction has defect snapshots classified as before or after. Return results for correction 101, including defect types with no observations in either stage.
defect_type, before_count, after_count, and count_changedefect_type_id ascending| Column | Type | Description |
|---|---|---|
| correction_idPK | INT | Unique correction identifier |
| correction_name | VARCHAR(100) | Correction label |
| corrected_at | TIMESTAMP | Time the correction was applied |
| Column | Type | Description |
|---|---|---|
| defect_type_idPK | INT | Unique defect type identifier |
| type_name | VARCHAR(80) | Defect type name |
| Column | Type | Description |
|---|---|---|
| snapshot_idPK | INT | Unique snapshot row identifier |
| correction_id | INT | Correction associated with the snapshot |
| defect_id | INT | Identifier of the observed defect |
| defect_type_id | INT | Defect classification |
| stage | VARCHAR(20) | Observation stage, before or after |