Ben @benjdd.com · Oct 29

Foreign keys vs constraints. Many conflate the two. Foreign key: A column that establishes a relationship between two tables. This is frequently set up as a column in one table (post) that stores primary key values from another table (user) so that it can join between the two.

3 likes 2 replies

?

Replies

Oleg Vakarev · Oct 29

also this is so cool github.com/planetscale/...

Ben · Oct 29

Foreign key constraint: A feature that causes the DBMS to enforce the integrity of foreign keys. It ensures that values in the foreign key column (post->user_id) refer to a valid entry in the other table (user->id).