2.10: Foreign Keys

Now, you're going to learn about foreign keys and primary keys. Click here to watch a video introducing these concepts. SQL Server is used in the video instead of pgAdmin, so the specific steps to set up tables and keys are different. However, the underlying concept is the same and can be applied to PostgreSQL. After watching the video, you can follow this link to read about establishing constraints with PostgreSQL.

Use what you've learned to complete the exercise below. Replace the XXXXXXXXs with the correct references to complete the query below:

To see the solution for this challenge, click on 2.12 Solutions. Once you have double-checked your solution, run the query in pgAdmin and refresh your database. You should see a "Purchases" table, which you'll use in the next lesson.

Then, continue to Part 2.11: Join.

Last updated