# Related Tables and Foreign Keys

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.

![Cheat sheet: Related Tables and Foreign Keys](https://fsdtrainingmedia.blob.core.windows.net/public/images/2026/11/a7a2da955b094ada8c55571857cc666b.webp)

- Category: FastAPI
- Level: Journeyman
- Tags: database, Foreign Key, ON DELETE CASCADE, One-to-Many Relationship, PRAGMA, Referential Integrity, sql, sqlite
- Author: Gregor Dzierzon
- Updated: November 23, 2026

Source: https://www.ask-codey.com/cheat-sheets/fastapi-sql-foreign-keys-cheat-sheet
