# Tables That Point at Each Other

Tables That Point at Each Other: Related Tables and Foreign Keys, Joining Tables.

Updated: November 19, 2026

1. [Related Tables and Foreign Keys](https://www.ask-codey.com/lessons/fastapi-sql-foreign-keys) (Journeyman): One vendor sells many products, so the products go in a table of their own and each product row holds its vendor's id in a foreign key column that REFERENCES the vendors table, a link SQLite checks only once PRAGMA foreign_keys = ON is sent on the connection.
2. [Joining Tables](https://www.ask-codey.com/lessons/fastapi-sql-joins) (Journeyman): A JOIN puts two related tables back together in one query, matching each product to its vendor with ON and naming columns from both tables through short aliases, and a LEFT JOIN keeps the vendors that have no products yet, with None where a product would be.

Source: https://www.ask-codey.com/courses/python-web-apis/topics/fastapi-tables-that-point
