In the context of relational databases, a foreign key is a referential constraint between two tables. The foreign key identifies a column or a set of columns in one (referencing) table that refers to a column or set of columns in another (referenced) table. The columns in the referencing table must be the primary key or other candidate key in the referenced table. The values in one row of the referencing columns must occur in a single row in the referenced table.

PropertyValue
dbpprop:abstract
  • In the context of relational databases, a foreign key is a referential constraint between two tables. The foreign key identifies a column or a set of columns in one (referencing) table that refers to a column or set of columns in another (referenced) table. The columns in the referencing table must be the primary key or other candidate key in the referenced table. The values in one row of the referencing columns must occur in a single row in the referenced table. Thus, a row in the referencing table cannot contain values that don't exist in the referenced table (except potentially NULL). This way references can be made to link information together and it is an essential part of database normalization. Multiple rows in the referencing table may refer to the same row in the referenced table. Most of the time, it reflects the one (master table, or referenced table) to many (child table, or referencing table) relationship. The referencing and referenced table may be the same table, i.e. the foreign key refers back to the same table. Such a foreign key is known in as self-referencing or recursive foreign key. A table may have multiple foreign keys, and each foreign key can have a different referenced table. Each foreign key is enforced independently by the database system. Therefore, cascading relationships between tables can be established using foreign keys. Improper foreign key/primary key relationships or not enforcing those relationships are often the source of many database and data modeling problems.
  • Cizí klíč (FOREIGN KEY) je v prostředí relačních databází integritní omezení, které u tabulky vytvoří spojení jednoho nebo více jejích sloupců se sloupcem nebo sloupci jiné („cizí“) tabulky. Pokud se hodnoty dotčených sloupců shodují, poté příslušný řádek cizí tabulky rozvíjí řádek zdrojové tabulky přes toto spojení. Tomu se též říká reference nebo odkaz. Cizí klíč umožňuje definovat akce, které mají nastat při pokusu o změnu nebo mazání záznamů v cizí tabulce. Například, po smazání záznamu z cizí tabulky budou ve zdrojové tabulce řádky s odpovídající hodnotou cizího klíče taktéž smazány, nebo budou jejich odkazy nastaveny na určitou (neutrální) hodnotu, nebo se smazání řádků v cizí tabulce zabrání. Omezení cizích klíčů tak představuje mechanismus pro udržení referenční integrity databáze.
  • Une clé étrangère, dans une base de données relationnelle, est une contrainte qui garantit l'intégrité référentielle entre deux tables. Une clé étrangère identifie une colonne ou un ensemble de colonnes d'une table comme référençant une colonne ou un ensemble de colonnes d'une autre table (la table référencée). Les colonnes de la table référencée doivent faire partie d'une contrainte de clé primaire ou d'une contrainte d'unicité. La contrainte de clé étrangère garantit que les valeurs de chaque ligne de la table référençant existent dans la table référencée : ainsi une ligne de la table référençant ne peut pas contenir un ensemble de valeurs qui n'existe pas dans la table référencée. Une contrainte de clé étrangère permet ainsi d'établir des liens entre plusieurs tables : il s'agit d'un des principes fondamentaux des bases de données relationnelles.
  • Nel contesto dei database relazionali, una chiave esterna è un vincolo di referenziazione tra due tabelle. La chiave esterna identifica una colonna o un insieme di colonne di una tabella (referenziante) che referenzia una colonna o un insieme di colonne di un'altra tabella (referenziata). I valori di un record delle colonne referenzianti devono essere presenti in un unico record della tabella referenziata. Ciò implica che un record nella tabella referenziante non piò contenere valori che non esistono nella tabella referenziata (eccetto nel caso particolare di valori NULL). Più record della tabella referenziante possono puntare allo stesso record della tabella referenziata. Nella maggior parte dei casi, ciò corrisponde alla relazione "uno a molti" tra una tabella padre ed una tabella figlio. La tabella referenziante e quella referenziata possono essere la stessa tabella. Una chiave esterna di questo tipo è anche chiamata auto-referenziante o ricorsiva. Una tabella può avere molte chiavi esterna, ed ogni chiave esterna può referenziare una tabella diversa.
  • 外部キー(がいぶキー、英: foreign key, FK)は、コンピュータの関係データベースの関係モデルの文脈において、2つの関係変数 の間の参照整合性制約をいう。 外部キーは、参照する側の関係変数で1つの属性 (列、カラム) もしくは2つ以上の属性の集合を同定し、参照する側の関係変数は、参照される側の関係変数の1つの属性もしくは2つ以上の属性の集合を参照する。 参照する側の関係変数の属性の1つの組 (タプル、行) の値は、参照される側の関係変数の組の値として出現しなければならない。 このため、参照する側の関係変数の組には、参照される側の関係変数に現れない値を、含むことはできない。 このような参照関係は、2つの情報の関連づけるために作成され、関係の正規化の本質的な部分をなしている。 参照する側の関係変数の複数の組が、参照される側の関係変数の同一の組を、参照することができる。 参照する側の関係変数と参照される側の関係変数が、同一の関係変数であっても良い。 すなわちこの場合は外部キーは自分自身の関係変数を参照する。 このような外部キーは、データベース言語標準 SQL:2003 では「自己参照」外部キーあるいは「再帰的」外部キーとして規定されている。 一つの関係変数には複数の外部キーを含むことができる。 そしてこのような外部キーのそれぞれが異なる関係変数を参照する。 各々の外部キーは関係データベース管理システム (RDBMS) によりそれぞれ別個に強制適用される。 このため、関係変数間の連鎖した関連を外部キーを使って定義することができる。 外部キー-主キーの関連を本来は設計の観点から存在していてはならない場合に存在していることや、外部キー-主キーの関連が本来は設計の観点から存在しているべきである場合に存在していないことは、関係データベースおよびデータモデリング、データベース設計についての多くの問題の原因となっていることが多い。
  • O conceito de Chave estrangeira em uso de banco de dados se refere ao tipo de relacionamento entre as tabelas de dados do banco de dados. Uma chave estrangeira é chamada quando há o relacionamento entre duas tabelas. Sempre em chave estrangeira vai haver relacionamentos entre tabelas, por exemplo, se uma tabela que tem uma chave primária de outra tabela.
  • Вне́шний ключ — понятие теории реляционных баз данных. Внешним ключом называется поле таблицы, предназначенное для хранения значения первичного ключа другой таблицы с целью организации связи между этими таблицами. Пусть имеются таблицы A и B. Таблица A содержит поля a, b, c, d, из которых поле a — первичный ключ. Таблица B содержит поля x, y, z. В поле y содержится значение поля a одной из записей таблицы A. В таком случае поле y и называется внешним ключом таблицы A в таблице B. Вот такой SQL-запрос вернёт все связанные пары записей из таблиц A и B: select * from A, B where A. a = B. y; Внешний ключ в таблице может ссылаться и на саму эту таблицу. В таких случаях говорят о рекурсивном внешнем ключе. Рекурсивные внешние ключи используются для хранения гомогенной древовидной структуры данных в реляционной таблице. Развитые СУБД поддерживают автоматический контроль ссылочной целостности на внешних ключах.
  • 外來鍵(foreign key,中国大陆译作外码,台湾译作外来键),又称外码。 在關聯式資料庫中,每個資料表都是由關聯來連繫彼此的關係,父資料表(Parent Entity)的主鍵會放在另一個資料表當屬性建立彼此的關聯,而這個屬性就是外來鍵。 例如:學生跟老師之間是教學的關聯,學生資料表會有個屬性叫指導老師(FK),而這個值就是對應到老師資料表的老師代號(PK),學生的指導老師就是外來鍵。
dbpprop:hasPhotoCollection
dbpprop:reference
rdf:type
rdfs:comment
  • In the context of relational databases, a foreign key is a referential constraint between two tables. The foreign key identifies a column or a set of columns in one (referencing) table that refers to a column or set of columns in another (referenced) table. The columns in the referencing table must be the primary key or other candidate key in the referenced table. The values in one row of the referencing columns must occur in a single row in the referenced table.
  • Cizí klíč (FOREIGN KEY) je v prostředí relačních databází integritní omezení, které u tabulky vytvoří spojení jednoho nebo více jejích sloupců se sloupcem nebo sloupci jiné („cizí“) tabulky. Pokud se hodnoty dotčených sloupců shodují, poté příslušný řádek cizí tabulky rozvíjí řádek zdrojové tabulky přes toto spojení. Tomu se též říká reference nebo odkaz.
  • Une clé étrangère, dans une base de données relationnelle, est une contrainte qui garantit l'intégrité référentielle entre deux tables. Une clé étrangère identifie une colonne ou un ensemble de colonnes d'une table comme référençant une colonne ou un ensemble de colonnes d'une autre table (la table référencée). Les colonnes de la table référencée doivent faire partie d'une contrainte de clé primaire ou d'une contrainte d'unicité.
  • Nel contesto dei database relazionali, una chiave esterna è un vincolo di referenziazione tra due tabelle. La chiave esterna identifica una colonna o un insieme di colonne di una tabella (referenziante) che referenzia una colonna o un insieme di colonne di un'altra tabella (referenziata). I valori di un record delle colonne referenzianti devono essere presenti in un unico record della tabella referenziata.
  • O conceito de Chave estrangeira em uso de banco de dados se refere ao tipo de relacionamento entre as tabelas de dados do banco de dados. Uma chave estrangeira é chamada quando há o relacionamento entre duas tabelas. Sempre em chave estrangeira vai haver relacionamentos entre tabelas, por exemplo, se uma tabela que tem uma chave primária de outra tabela.
  • Вне́шний ключ — понятие теории реляционных баз данных. Внешним ключом называется поле таблицы, предназначенное для хранения значения первичного ключа другой таблицы с целью организации связи между этими таблицами. Пусть имеются таблицы A и B.
rdfs:label
  • Foreign key
  • Cizí klíč
  • Clé étrangère
  • Chiave esterna
  • 外部キー
  • Chave estrangeira
  • Внешний ключ
  • 外键
owl:sameAs
skos:subject
foaf:page
is dbpprop:disambiguates of
is dbpprop:redirect of
is owl:sameAs of