database - Does union of candidate keys together form a candidate key?
问题描述
Relation R
consists of columns {A,B,C,D}
. A
uniquely defines a tuple. So does B
. A
and B
are candidate keys, since they are minimal. What about a set {A,B}
? {A,B}
together uniquely defines a tuple, but it is not minimal.
What is the term for {A,B}
. Usually non-minimal candidate keys are called super keys. Is there a special name for a union of candidate keys?
EDIT:
Excuse me for imprecise question. It can indeed be clearer. As far as I understand, key == candidate key == minimal set of attributes that uniquely define a tuple.
解决方案
The union of candidate keys K1 and K2 yields a candidate key iff K1=K2, that is, if they are in fact the very same key. In all other cases, it will by definition yield a (super)key that isn't irreducible, and if your definition of "candidate key" is that it is an irreducible (super)key then (the result of) that union is obviously no longer a candidate key.
As for keys terminology, I think most respectable (there are others too) textbooks stick to the convention :
"superkey" = just any key
"candidate key" = irreducible (=minimal) superkey
non-minimal superkey = "proper superkey" (and not just "superkey" as you stated)
"key" is supposed to be used as synonym for "candidate key" but the linguistics of the word cause it to often also be used with the meaning of "just any key". Beware !
And no, I don't think there is a special term for the particular kind of proper superkey that happens to be a union of two (or more) candidate keys. There is no useful purpose in ever knowing such a thing about a key.
推荐阅读
- ios - 如何使用静态单元格本地化 UITableView 标题的情节提要
- angularjs - AngularJs 应用程序在 Spring 启动中提供服务。页面刷新时 Spring 容器返回 404
- php - PHP/MySQL - 单击按钮时未获得表中的第一个 ID
- bash - 在循环密钥文件时使用 AWK 搜索另一个数据文件
- android - 将依赖项添加到 android 库 'api' vs 'implementation'
- java - 如何更改 ElasticSearch6 Java RestHighLevel 客户端的 close() 方法的行为?
- angular - How to implement generic error handling that works with forkJoin in Angular 6?
- powerbi - Power BI - 通过另一个表中的值应用过滤器并获取另一个表上的最小日期
- php - 在 API 环境中使用 PHP SESSIONS
- python - 当有超过 1 个 GPU 时,如何在推理中使用多线程?