Skip to main content
Admissions guidance, study banks, and career tools — get started on Shalyam

Students and Courses Junction Table

Medium Schema Design

Model students enrolling in courses (many-to-many) so that a student cannot be enrolled in the same course twice. Write the CREATE TABLE for the junction table.

Table schema

Students(id INT PRIMARY KEY, name VARCHAR(50))
Courses(id INT PRIMARY KEY, title VARCHAR(50))

Sample data

Enrolling student 1 in course 10 twice must fail the second time.

Discussion

No discussions yet.

Rewards · v2.1

Get Exclusive Insights with Every Issue

Join Shalyam Newsletter

Stay ahead in education, research, and innovation—straight to your inbox.