From the course: PHP with MySQL Essential Training: 1 The Basics

Unlock the full course today

Join today to access over 24,900 courses taught by industry experts.

Relational database tables

Relational database tables

- [Instructor] So far, we've been able to create our subjects table and to populate it. We also know that we're going to need a pages table as well. And our pages table is going to have a relationship to our subjects table. So it's worth taking a moment to talk about how relational database tables work. The idea behind them is simple, but the results are powerful. Imagine the first subject like About Globe Bank. It's going to have a set of pages that should be listed underneath that subject. This is what we would call a one-to-many relationship because we have one subject and then below it, there are many pages. Those pages belong to that subject. Why are these types of relationships important? Imagine that when we display a page, we want to show the name of the subject that goes with that page. We could store the subject name in the pages table. So we might have a pages table that looks like this. You'll notice that the third column there is subject_name and you can see that I've…

Contents