Your question is Fastest Mastery Segment SQL. 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 identify learners who reach skill mastery most efficiently. Write a PostgreSQL query that finds the fastest 5% of learners based on the elapsed time between their first practice attempt and their first recorded mastery.
mastery_level = 'mastered'.learner_id, learner_name, mastered_skills, avg_hours_to_mastery, rank_position, and eligible_learner_count.| Column | Type | Description |
|---|---|---|
| learner_idPK | INT | Unique Khan Academy learner identifier |
| learner_name | VARCHAR(100) | Display name of the learner |
| Column | Type | Description |
|---|---|---|
| attempt_idPK | INT | Unique practice attempt identifier |
| learner_id | INT | Learner who made the attempt |
| skill_name | VARCHAR(100) | Khan Academy skill practiced |
| attempted_at | TIMESTAMP | Timestamp when the practice attempt occurred |
| Column | Type | Description |
|---|---|---|
| mastery_event_idPK | INT | Unique mastery event identifier |
| learner_id | INT | Learner associated with the mastery event |
| skill_name | VARCHAR(100) | Khan Academy skill whose mastery status changed |
| mastery_level | VARCHAR(30) | Recorded status, such as in_progress or mastered |
| mastered_at | TIMESTAMP | Timestamp when the status was recorded |