How would you write a SQL query to compute daily trading volume by symbol and rank the top symbols each day?
Assume volume is the sum of positive, non-null quantities. Return the three highest-ranked symbols for each day, including ties at the cutoff.
trading_date, symbol, daily_volume, and daily_rank.trading_date, daily_rank, then symbol.| Column | Type | Description |
|---|---|---|
| trade_idPK | INT | Unique trade identifier |
| symbol | VARCHAR(12) | Traded security symbol |
| trade_timestamp | TIMESTAMP | Timestamp when the trade occurred |
| quantity | NUMERIC(18,2) | Number of shares traded |