FastPrepStudents and Their Subjects

Students and Their Subjects

Birla Pivot logoBirla Pivot● EasyFULLTIMEOA

Problem statement

Join Students, StudentSubjects, and Subjects to list the subjects studied by each enrolled student. Return student_id, student_name, and subject_name, with one row per enrollment.

Students with no enrollment do not appear. Different subjects with the same name still produce separate rows.

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

ColumnTypeNullableDescription
idPKIntegerNo—
nameTextNo—

Subjects

ColumnTypeNullableDescription
idPKIntegerNo—
nameTextNo—

StudentSubjects

ColumnTypeNullableDescription
student_idPKIntegerNo—
subject_idPKIntegerNo—

Foreign key: student_id → Students(id)

Foreign key: subject_id → Subjects(id)

Expected result

Your query or function must return these columns.

ColumnTypeNullableDescription
student_idIntegerNo—
student_nameTextNo—
subject_nameTextNo—

Row order: any order is accepted. Numeric tolerance: 0.

Constraints

  • The practice schema uses Students(id, name), Subjects(id, name), and StudentSubjects(student_id, subject_id). IDs are positive integers.
  • Each student-subject pair is unique and references existing rows. Names are non-null, at most 100 characters, and need not be unique.
  • Each table has at most 2000 rows. Empty tables are allowed. Output rows may be in any order.

More Birla Pivot problems

See Birla Pivot hiring insights