Write SQL queries to (1) pick the latest transaction for each credit card and compute total transactions per card, and (2) aggregate Team_A and Team_B results into total played, won, lost, and drawn.
Use the supplied tables. Rows with a NULL card number, transaction time, or match result are ignored. The combined output should distinguish card and team summaries.
result_type, entity, latest_transaction_id, transaction_count, played, won, lost, drawnresult_type, then entity| Column | Type | Description |
|---|---|---|
| transaction_idPK | INTEGER | Unique transaction identifier |
| card_number | VARCHAR(30) | Credit card identifier |
| transaction_time | TIMESTAMP | Transaction timestamp |
| amount | NUMERIC(12,2) | Transaction amount |
| Column | Type | Description |
|---|---|---|
| match_idPK | INTEGER | Unique match identifier |
| team | VARCHAR(30) | Team whose result is recorded |
| opponent | VARCHAR(30) | Opposing team |
| result | VARCHAR(20) | Match result such as WON, LOST, DRAWN, or IN_PROGRESS |
| match_date | DATE | Date of the match |