Your question is Top 5 Assets Query. Start with the requirements and the two tables on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Write a query to find the top 5 performing assets from this table.
Assume performance is measured by each asset's average non-null return_pct, using records from asset_performance. Include only assets whose status is Active, and use assets with asset_performance.
asset_name and average_return_pct.asset_id ascending as the tie-breaker.| Column | Type | Description |
|---|---|---|
| asset_idPK | INT | Unique asset identifier |
| asset_name | VARCHAR(100) | Display name of the asset |
| status | VARCHAR(20) | Current asset status |
| asset_class | VARCHAR(40) | Asset classification |
| Column | Type | Description |
|---|---|---|
| performance_idPK | INT | Unique performance record identifier |
| asset_id | INT | Referenced asset identifier |
| performance_date | DATE | Date of the performance observation |
| return_pct | DECIMAL(7,2) | Asset return percentage for the observation |