From the course: PostgreSQL Essential Training

Unlock the full course today

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

Link primary and foreign keys

Link primary and foreign keys - PostgreSQL Tutorial

From the course: PostgreSQL Essential Training

Link primary and foreign keys

- [Instructor] We just created two tables in the Kinetico database and I want to create a relationship between them. Just to review where we are in the process, let's run a quick select query by clicking on the query tool here and we can see the table structure. First, I'll select everything or select star from manufacturing.products. Press the play button to execute the query and you'll see the results here. Now we don't have any data in the table yet but this query does show us the columns and the data types that make up the table structure. Each row in the table will represent an individual product that Kinetico sells, and we have columns for the product id, its name and power rating as well as the cost to manufacture it. The last column is called Category ID and it'll store an integer value. I want to use this column to look up a value in the other table that we built. Let's go ahead and take a look at that one.…

Contents