V2EX  ›  英汉词典

Primary Key

释义 Definition

primary key(主键)是数据库术语,指在数据库表中唯一标识每一条记录的字段或字段组合。主键的值不能重复,也不能为空。在更广义的用法中,也可指"最主要的关键因素"。

发音 Pronunciation

/ˈpraɪ.mɛr.i kiː/

例句 Examples

Every table in the database must have a primary key to uniquely identify each row.
数据库中的每张表都必须有一个主键,用来唯一标识每一行记录。

When designing the schema, we decided to use a composite primary key consisting of both the user ID and the timestamp, ensuring that no two entries from the same user at the same time could exist.
在设计数据库结构时,我们决定使用由用户ID和时间戳组成的复合主键,以确保同一用户在同一时间不会有重复的记录。

词源 Etymology

primary 源自拉丁语 primarius,意为"第一位的、首要的",由 primus(第一)派生而来。key 源自古英语 cǣġ,原指开锁的钥匙,后引申为"关键、要素"。primary key 作为数据库术语,最早随关系型数据库理论在20世纪70年代由 E.F. Codd 提出,用来指代在关系表中唯一标识记录的核心字段,如同一把"钥匙"能唯一打开对应的那条数据。

相关词汇 Related Words

文学与技术作品引用 Notable References

  • E.F. Codd 的经典论文 A Relational Model of Data for Large Shared Data Banks(1970)首次系统阐述了主键的概念,奠定了关系型数据库的理论基础。
  • C.J. Date 的 An Introduction to Database Systems 中对 primary key 有深入且权威的讲解,是数据库学习者的必读之作。
  • Martin Fowler 的 Patterns of Enterprise Application Architecture 中多次讨论了主键的设计策略,包括自增主键与自然主键的选择。
关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   1029 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 17ms · UTC 22:48 · PVG 06:48 · LAX 15:48 · JFK 18:48
♥ Do have faith in what you're doing.