From the course: Programming Foundations: Databases

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

Relationships

Relationships

- As a database becomes more complex, with two or more tables containing data that we want to connect in some way, we need to define relationships. We need to tell the database that particular records should be associated with each other. Of course, we can use a database without using relationships. Simply querying a piece of information from this table and a piece of information from that table, but being able to connect records to each other in various ways, lets us use data in more complex and realistic applications. There are three general kinds of relationships to use with databases, one to may, many to many, and one to one. A relationship starts out as something that exists in the model of the data. It's something we know about how the data will be used when we go to read or modify the data in the database. Later we'll see how to get the database to enforce our relationships. One to many is by far the most common…

Contents