From the course: Programming Foundations: Databases
Unlock the full course today
Join today to access over 24,100 courses taught by industry experts.
One-to-many relationships
From the course: Programming Foundations: Databases
One-to-many relationships
- Let's take a look at the one-to-many relationship. This is the most common type of relationship that databases use. It connects one piece of data, one row of a table to one or more other pieces of data. This relationship is represented by a line that looks like this. One endpoint for the one side of the relationship to a little symbol called a crow's foot, representing many endpoints. Let's consider our Customers table and our Dishes table here for a moment. We want to represent our customer's favorite dish in the Customers table. For each customer, we would write the name of the dish in the FavoriteDish column. But this is a lot of work, and if we ever change the name of a dish, maybe if we notice a spelling error in our Dishes table, we'd need to be conscientious and update the name in our Customers table as well. In a small database, this may not be a huge problem, but in a large database, this kind of hands-on…