From the course: Database Foundations: Data Structures
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Many-to-many relationships
From the course: Database Foundations: Data Structures
Many-to-many relationships
- [Instructor] The third and final type of relationship that you can create is a many-to-many relationship. If you've been following along, then it's probably no surprise that a many-to-many relationship is created between two columns where neither of them have a unique constraint applied. A common example of a many-to-many relationship looks like this. We have a class schedule database with one table to store information about students and a second table that stores information about classes. We want to allow each student to take many different classes, and we also want each class to have many different students. However, there isn't a good way to relate the tables together based off of the columns that we have. To create the relationship, we would need a non-unique column in each table and that can get messy if we have multiple Andrea's at the same school or if physics is offered at different times of the day. In…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
(Locked)
One-to-many relationships2m 13s
-
(Locked)
One-to-one relationships1m 27s
-
(Locked)
Many-to-many relationships2m 14s
-
(Locked)
Self-referencing relationships1m 56s
-
(Locked)
Cascade updates and deletes4m 35s
-
(Locked)
Challenge: Link tables with keys1m 8s
-
(Locked)
Solution: Link tables with keys6m 23s
-
(Locked)
-
-
-