候选键 主键 超键

Candidate key 候选键
A Candidate key is a set of one or more attributes that can uniquely identify a row in a given table.

Primary Key 主键
During the creation of the table, the Database Designer chooses one of the Candidate Key from amongst the several available, to uniquely identify row in the given table.
The candidate key that is chosen to perform the identification task is called the primary key.

Alternate Key
The candidate key that is chosen to perform the identification task is called the primary key and the remaining candidate keys are known as alternate keys.

Super Key 超键
Any superset of a candidate Key is a super key.
超键能唯一标识记录。
候选键是没有多余属性的超键。

Foreign Key 外键
A Foreign Key is a set of attributes whose values are required to match values of a Candidate key in the same or another table.
The attributes other than the Primary Key attributes in a table/relation are called Non-Key attributes.

员工信息表:员工号,姓名,身份证号,性别,年龄

员工号唯一,是一个超键。
身份证号唯一,是一个超键。
(员工号,姓名)唯一,是一个超键。
(员工号,姓名,身份证号)唯一,是一个超键。

员工号唯一,没有多余属性,是一个候选键。
身份证号唯一,没有多余属性,是一个候选键。

考虑查询的便利,可以选择员工号为主键,也可以选择身份证号为主键。

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值