From the course: Learning Relational Databases

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Create junction tables

Create junction tables

From the course: Learning Relational Databases

Start my 1-month free trial

Create junction tables

- [Instructor] In your data model, you may have created two tables that are joined together in a many-to-many relationship. If that's the case, now is the time to resolve that into a format that can be implemented in the database management system. We do this by creating a third table, called a "junction table", that sits between the other two. The most common example of a many-to-many relationship is the case of a class schedule, which includes the table storing information about students, and the table that stores information about various classes that are being offered. We'll note that each student can take between zero and several classes, and each class would have several students enrolled. Thus, a many-to-many relationship exists between these two tables. This accurately represents the real world situation that we're trying to capture. But in order to actually create this in the database, we need to create an intermediary table that sits between the students and the classes…

Contents