V2EX  ›  英汉词典

Foreign Key

定义 Definition

foreign key(外键):数据库表中的一个字段(或字段组合),其取值必须来自另一张表(或同一张表)中被引用的主键/唯一键,用于建立表与表之间的关系,并保证参照完整性(防止出现“找不到对应记录”的数据)。

发音 Pronunciation (IPA)

/ˈfɔːrən kiː/

例句 Examples

A foreign key links this table to the customers table.
外键把这张表与客户表关联起来。

If you delete a customer record, the foreign key constraint may prevent orphan orders unless cascading is enabled.
如果你删除一条客户记录,除非启用级联操作,否则外键约束可能会阻止产生“无主”的订单记录。

词源 Etymology

foreign 原义为“外来的、来自别处的”,在数据库语境里表示“来自另一张表的键”;key 在计算机与数据库中常指“用于唯一标识或建立关联的字段”。合起来 foreign key 就是“引用外部(他表)键值来建立关系的键”。

相关词 Related Words

文献与作品 Literary Works

  • Database System Concepts(Silberschatz, Korth, Sudarshan)
  • SQL in a Nutshell(O’Reilly)
  • Learning SQL(Alan Beaulieu)
  • Designing Data-Intensive Applications(Martin Kleppmann)
关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   892 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 22ms · UTC 23:21 · PVG 07:21 · LAX 15:21 · JFK 18:21
♥ Do have faith in what you're doing.