Your question is Student Second Maximum Score. 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.
BharatPe's learning and onboarding program stores students and their exam attempts. Write a PostgreSQL query to identify students whose best score is the second-highest distinct score across all students.
student_id.| Column | Type | Description |
|---|---|---|
| student_idPK | INTEGER | Unique student identifier |
| student_name | VARCHAR(100) | Student's full name |
| Column | Type | Description |
|---|---|---|
| attempt_idPK | INTEGER | Unique exam attempt identifier |
| student_id | INTEGER | Logical reference to the student who made the attempt |
| score | INTEGER | Attempt score, which may be NULL when not evaluated |