SQLite Forum

Help with foreign key
Login
Then see [CREATE TABLE](https://sqlite.org/lang_createtable.html), and be sure to expand the "column-def:", "column-constraint:" and "foreign-key-clause:" items.

Since you are designing your own schema, which will certainly be more detailed than what your 1st post stated, and probably ought to include even more tables, I still suggest reading up on what foreign keys do. You have decisions to make about [referential integrity](https://database.guide/what-is-referential-integrity/), including whether and/or how to achieve and enforce it.

I have to assume you are a programming neophyte, so I offer this advice which you will sooner or later appreciate was needed if you keep at it:

(1) Choose meaningful but short names (aka "identifiers") for your tables and columns. Your SQL involving those names will be more comprehensible for it, which is important when writing it but even more important later when trying to understand and maybe revise it.

(2) Develop **some level** of understanding of [Database normalization](https://en.wikipedia.org/wiki/Database_normalization). But do not let the complexity of the higher numbered forms dissuade you from eschewing them all. (That's why I stress "some level".)

(3) Beware of short-term-gain versus long-term-pain tradeoffs.

Good luck.