Write a SQL query to identify discrepancies between expected and actual user balances after a trade at Gemini. Use the users, expected_balances, and actual_balances tables. Include mismatches and records missing from either balance source.
user_id, email, trade_id, expected_balance, actual_balance, discrepancy_amount, and status.user_id, then trade_id.| Column | Type | Description |
|---|---|---|
| user_idPK | INT | Gemini user identifier |
| VARCHAR(255) | User email address |
| Column | Type | Description |
|---|---|---|
| user_idPK | INT | User associated with the expected balance |
| trade_idPK | INT | Trade identifier |
| expected_balance | NUMERIC(18,2) | Balance expected after the trade |
| Column | Type | Description |
|---|---|---|
| user_idPK | INT | User associated with the actual balance |
| trade_idPK | INT | Trade identifier |
| actual_balance | NUMERIC(18,2) | Balance recorded after the trade |