Your question is Second Attempt Score Per User. Start with the requirements and the three 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.
Khan Academy wants to analyze how students perform after their first attempt on a quiz exercise. Write a PostgreSQL query that returns the second attempt score for every student who attempted exercise 101 more than once.
attempted_at ascending, using attempt_id as a tie-breaker.101.NULL second-attempt score, and sort the result by user_id.| Column | Type | Description |
|---|---|---|
| user_idPK | INT | Unique student identifier |
| username | VARCHAR(50) | Student username |
| Column | Type | Description |
|---|---|---|
| exercise_idPK | INT | Unique exercise identifier |
| exercise_name | VARCHAR(100) | Exercise title |
| Column | Type | Description |
|---|---|---|
| attempt_idPK | INT | Unique quiz attempt identifier |
| user_id | INT | Student who made the attempt |
| exercise_id | INT | Exercise attempted |
| score | NUMERIC(5,2) | Score from 0 to 100, possibly unavailable |
| attempted_at | TIMESTAMP | Timestamp when the attempt was submitted |