Write a SQL query to identify the top N records per category using window functions.
For this exercise, set N to 2. Use the supplied tables and return only records belonging to a known category.
category_name, record_id, record_name, score, and category_rank.record_id.category_name, then category_rank, then record_id.| Column | Type | Description |
|---|---|---|
| category_idPK | INT | Unique category identifier |
| category_name | VARCHAR(100) | Category display name |
| Column | Type | Description |
|---|---|---|
| record_idPK | INT | Unique record identifier |
| category_id | INT | Referenced category identifier |
| record_name | VARCHAR(100) | Record display name |
| score | NUMERIC(10,2) | Score used for ranking records |