外部キーとは
The relationship between customers table and orders table is one-to-many. And this relationship is established by the foreign key in the orders table specified by the customerNumber column.
出典
訳
顧客テーブルと受注テーブルの関係は、一対多である。そして、この関係は、customerNumber列で指定されたordersテーブルの外部キーによって確立されている。
出典 deepL
MySQL supports foreign keys, which permit cross-referencing related data across tables, and foreign key constraints, which help keep the related data consistent.
A foreign key relationship involves a parent table that holds the initial column values, and a child table with column values that reference the parent column values. A foreign key constraint is defined on the child table.
出典
訳
MySQL は、テーブル間で関連するデータの相互参照を可能にする外部キーと、関連するデータの一貫性を保つための外部キー制約をサポートしています。
外部キー関係には、最初のカラム値を保持する親テーブルと、親カラム値を参照するカラム値を保持する子テーブルが含まれます。子テーブルには、外部キー制約が定義されています。
出典 deepL
感想
関係を確立させるために外部キーを設定するのか。
何となく知っていたけど、改めて理解した気がする。
まだ自信がない。