Specifying foreign key relationships
Recall in Chapter 4, Connecting to Databases, how we learned that the relational part of a relational database comes from how records in one table relate to other records. One of the benefits of this is to save space. To see an example of this, let's have another look at our Reviews table, or simply turn back to Figure 5.5. Notice that aside from the review ID and star rating, all other columns in our Reviews table relate to other tables:
- The ID Order column relates to ID Order in the Orders table.
- The ID Menu column relates to ID Menu in the Menu table.
- The ID User column relates to ID User in the Users table.
Recall that when we first viewed our metadata for the Menu table, we saw that Metabase had determined that ID Menu was an Entity (or Primary) key. The same is true for ID Order in the Orders table and ID User in the Users table – they are all Entity keys. When we see an Entity key in a different table, as...