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 - 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.…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
(Locked)
Organize tables with schemas6m 35s
-
(Locked)
Create a table with pgAdmin6m 57s
-
(Locked)
Link primary and foreign keys6m 38s
-
(Locked)
Enforce referential integrity on related records6m 24s
-
(Locked)
Challenge: Execute a command on the Postgres server55s
-
(Locked)
Solution: Execute a command on the Postgres server5m 19s
-
(Locked)
-
-
-
-