A foreign key is a column or group of columns in a table that references the primary key constraint of another table. The foreign key constraint preserves the referential integrity of the data between the child and parent tables. The foreign key constraint indicates that values in a column or group of columns in the child table are equal to values in a column or group of columns of the main table.
A table can have more than one foreign key constraint, depending on its relationships with other tables.
CREATE TABLE musteriler(musteri_id INT GENERATED ALWAYS AS IDENTITY, musteri_ad VARCHAR(255) NOT NULL, PRIMARY KEY(musteri_id) ); CREATE TABLE iletisim_bilgileri( irtibat_id INT GENERATED ALWAYS AS IDENTITY, musteri_id INT, irtibat_ad VARCHAR(255) NOT NULL, tel VARCHAR(15), mail VARCHAR(100), PRIMARY KEY(irtibat_ id), CONSTRAINT fk_musteri FOREIGN KEY(musteri_id) REFERENCES musteriler(musteri_id) );