Write a SQL query to compare defect counts before and after a database migration.
Use the provided migrations and defects tables. Treat defects detected before the migration date as before-migration defects, and defects detected on or after that date as after-migration defects.
migration_id, system_name, migration_date, defects_before, defects_after, and count_changemigration_date ascending, then migration_id ascending| Column | Type | Description |
|---|---|---|
| migration_idPK | INT | Unique migration identifier |
| system_name | VARCHAR(100) | System affected by the migration |
| migration_date | DATE | Date the migration occurred |
| Column | Type | Description |
|---|---|---|
| defect_idPK | INT | Unique defect identifier |
| system_name | VARCHAR(100) | System where the defect was detected |
| detected_at | DATE | Date the defect was detected |
| status | VARCHAR(30) | Current defect status |