Given a database of trading execution metrics, write a SQL query to identify the top 5% most expensive trades by venue.
Use the execution_metrics table and consider completed trades with non-null execution costs. Use trade_id as the deterministic tie-breaker.
venue, trade_id, execution_cost, and venue_rank.venue, then venue_rank, then trade_id.| Column | Type | Description |
|---|---|---|
| trade_idPK | INT | Unique identifier for the trade |
| venue | VARCHAR(40) | Trading venue where the execution occurred |
| execution_cost | DECIMAL(14,2) | Total measured execution cost for the trade |
| execution_status | VARCHAR(20) | Execution lifecycle status |
| executed_at | TIMESTAMP | Timestamp when the trade was executed |