How would you union two tables when table A has 5 columns and table B has 8 columns?
Write a PostgreSQL query that combines the two supplied event tables while preserving all rows and returning a consistent eight-column result. Align the shared fields and represent unavailable fields from the five-column table as NULL values.
event_id, customer_id, event_date, amount, status, channel, region, and notesevent_date ascending, then event_id ascending, with NULL dates last| Column | Type | Description |
|---|---|---|
| event_idPK | INT | Unique event identifier |
| customer_id | INT | Customer associated with the event |
| event_date | DATE | Date on which the event occurred |
| amount | NUMERIC(10,2) | Signed monetary amount |
| status | VARCHAR(20) | Processing status |
| Column | Type | Description |
|---|---|---|
| event_idPK | INT | Unique event identifier |
| customer_id | INT | Customer associated with the event |
| event_date | DATE | Date on which the event occurred |
| amount | NUMERIC(10,2) | Signed monetary amount |
| status | VARCHAR(20) | Processing status |
| channel | VARCHAR(20) | Originating interaction channel |
| region | VARCHAR(30) | Customer or processing region |
| notes | TEXT | Free-form event notes |