Your question is SQL Query Writing for Students. Start with the requirements and the four 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.
Huron Consulting Group's learning analytics team needs a consolidated performance view for students whose name is exactly xyz. Write one PostgreSQL query that returns every matching student, including students without enrollments or assessment results.
LAG to evaluate score progression within each student-course history.LEFT JOIN operations and order the final output by student_id.students: (1, 'xyz'), (2, 'xyz'), (3, 'Amina Patel')
enrollments: (1001, 1, 101), (1002, 1, 102), (1003, 3, 103)
courses: (101, 'PostgreSQL Optimization'), (102, 'Data Strategy')
assessments: (5001, 1001, '2026-01-10', 78), (5002, 1001, '2026-02-10', 85), (5003, 1002, '2026-01-15', 91), (5004, 1002, '2026-02-15', NULL)
| Column | Type | Description |
|---|---|---|
| student_idPK | INT | Unique student identifier |
| student_name | VARCHAR(100) | Student's displayed name |
| VARCHAR(255) | Student email address |
| Column | Type | Description |
|---|---|---|
| enrollment_idPK | INT | Unique enrollment identifier |
| student_id | INT | References students.student_id |
| course_id | INT | References courses.course_id when available |
| enrollment_status | VARCHAR(20) | Enrollment state |
| Column | Type | Description |
|---|---|---|
| course_idPK | INT | Unique course identifier |
| course_name | VARCHAR(150) | Course title |
| course_category | VARCHAR(50) | Course subject category |
| Column | Type | Description |
|---|---|---|
| assessment_idPK | INT | Unique assessment identifier |
| enrollment_id | INT | References enrollments.enrollment_id |
| assessment_date | DATE | Date the assessment was recorded |
| score | INT | Assessment score from 0 to 100 |