Problem · Database
Students and Instructors for Database Systems
Problem statement
You are given four relational tables describing students, their course enrollments, courses, and instructors.
Return the name of every student enrolled in a course whose name is exactly Database Systems, together with that course's instructor name.
Table schema
MySQLPostgreSQLPandas
Use the same input data with any supported language. Open the Schema tab in the editor to see the generated SQL setup or Pandas DataFrames.
students
| Column | Type | Nullable | Description |
|---|---|---|---|
| student_idPK | Integer | No | — |
| student_name | Text | No | — |
enrollments
| Column | Type | Nullable | Description |
|---|---|---|---|
| enrollment_idPK | Integer | No | — |
| student_id | Integer | No | — |
| course_id | Integer | No | — |
courses
| Column | Type | Nullable | Description |
|---|---|---|---|
| course_idPK | Integer | No | — |
| course_name | Text | No | — |
| instructor_id | Integer | No | — |
instructors
| Column | Type | Nullable | Description |
|---|---|---|---|
| instructor_idPK | Integer | No | — |
| instructor_name | Text | No | — |
Expected result
Your query or function must return these columns.
| Column | Type | Nullable | Description |
|---|---|---|---|
| student_name | Text | No | — |
| instructor_name | Text | No | — |
Row order: must match exactly. Numeric tolerance: 0.
Constraints
- Each table's declared primary key is unique and non-null.
- Every enrollment references an existing student and course, and every course references an existing instructor.
- The course-name comparison is case-sensitive and must equal
Database Systems. - Return one row per matching enrollment, ordered by
student_nameascending and theninstructor_nameascending. - Within
enrollment,enrollment_idis the only uniqueness constraint; multiple rows may share the same student and course, and each matching enrollment produces one output row.