Affirm's quantitative analytics team is reviewing subject-level assessment results for analysts supporting Affirm financing decisions. Write a PostgreSQL query that identifies the top student or students in each subject for the current exam term.
2026-Spring exam term and exclude records where marks is NULL.| Column | Type | Description |
|---|---|---|
| student_idPK | INT | Unique student identifier |
| student_name | VARCHAR(100) | Student's full name |
| Column | Type | Description |
|---|---|---|
| subject_idPK | INT | Unique subject identifier |
| subject_name | VARCHAR(100) | Subject name |
| Column | Type | Description |
|---|---|---|
| score_idPK | INT | Unique score record identifier |
| student_id | INT | References students.student_id |
| subject_id | INT | References subjects.subject_id |
| marks | INT | Marks earned in the assessment |
| exam_term | VARCHAR(30) | Assessment term |