Your question is Write SQL Join With Left Join. 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.
CarGurus Learning uses student and course records to track internal technical training. Write a PostgreSQL query that lists every student and any course enrollment associated with that student.
students, including students with no enrollment.LEFT JOIN so students without a matching enrollment remain in the result with NULL course columns.student_id, then course_id.| Column | Type | Description |
|---|---|---|
| student_idPK | INTEGER | Unique student identifier |
| student_name | VARCHAR(100) | Student's full name |
| Column | Type | Description |
|---|---|---|
| enrollment_idPK | INTEGER | Unique enrollment identifier |
| student_id | INTEGER | References students.student_id |
| course_id | INTEGER | References courses.course_id |
| Column | Type | Description |
|---|---|---|
| course_idPK | INTEGER | Unique course identifier |
| course_code | VARCHAR(20) | Short course code |
| course_title | VARCHAR(150) | Course title |