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.
Shalyam Support
Hi! Ask us anything — we'll reply on WhatsApp or Telegram within 24 hours.