Can you explain the difference between a left join and an inner join in a practical scenario for investment data?
Use the tables below to compare trade records with account reference data. Write a SQL query that returns all trades with their account status when available, and keeps trades even when no matching account exists.
trade_id, account_id, trade_date, trade_amount, account_status.NULL for account_status in those rows.trade_amount is NULL.trade_date ascending, then trade_id ascending.| Column | Type | Description |
|---|---|---|
| trade_idPK | INT | Unique trade identifier |
| account_id | INT | Account identifier associated with the trade |
| trade_date | DATE | Trade execution date |
| trade_amount | NUMERIC(12,2) | Trade notional amount |
| Column | Type | Description |
|---|---|---|
| account_idPK | INT | Unique account identifier |
| account_status | VARCHAR(20) | Current account status |