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.

By

Updated

Cheat sheet: Related Tables and Foreign Keys
Category
FastAPI
Level
Journeyman
Tags
database, Foreign Key, ON DELETE CASCADE, One-to-Many Relationship, PRAGMA, Referential Integrity, sql, sqlite