候选键的子集 [英] Subset of a candidate key

查看:127
本文介绍了候选键的子集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们知道候选键是唯一标识关系中行的列或列组合.

As we know a candidate key is a column or combination of columns that uniquely identifies the rows in a relation.

假设我有一个关系,其中候选键是列的组合.我想问,

Suppose I have a relation in which candidate keys are combinations of columns. I want to ask,

候选键的子集是否也可能唯一标识该行?

is it possible that a subset of a candidate key also uniquely identifies the row?

候选键是没有唯一标识行的子集的键吗?

is a candidate key a key for which there is no subset that uniquely identifies the row?

推荐答案

候选键是一列或列的组合.或更正确地说,是一组一个或多个列.或更准确地说,是一组列.

A candidate key is a column or combination of columns. Or more correctly a set of one or more columns. Or more correctly a set of columns.

候选键是唯一标识行的一组列,并且不包含唯一标识行的较小(适当")列子集.

A candidate key is a set of columns that uniquely identifies rows and that contains no smaller ("proper") subset of columns that uniquely identifies rows.

超键是一组唯一标识行的列.因此,候选键是不包含更小的超级键的超级键.

A superkey is a set of columns that uniquely identifies rows. So a candidate key is a superkey that contains no smaller superkey.

在SQL中,您不能声明空的候选键.同样,UNIQUE NOT NULL和PRIMARY KEY(在约束方面仅表示UNIQUE NOT NULL)声明了超键,而不是键本身.如果这样的声明的列集不包含声明为超键的较小列集,则它声明的超键是候选键.

In SQL you can't declare an empty candidate key. Also, UNIQUE NOT NULL and PRIMARY KEY (which in terms of constraints just means UNIQUE NOT NULL) declare superkeys, not keys per se. If such a declaration's column set doesn't contain a smaller column set declared as a superkey then the superkey it's declaring is a candidate key.

您的问题最初说的是,您有一个关系,其中候选关键字是关键字组合".也许您的意思是,某个超键(列)的较小子集是一个超键或候选键.

Your question originally said that you had a relation in which candidate keys are a "combination of keys". Maybe you meant something like, some smaller subset of (columns of) a superkey is a superkey or candidate key.

因此,不能,候选密钥不能包含较小的候选密钥.另一方面,在SQL中,您可以在另一个UNIQUE/PK声明的较小列子集上拥有UNIQUE/PK声明.但是,后者将不会成为候选密钥.

So no, a candidate key cannot contain a smaller candidate key. On the other hand in SQL you can have a UNIQUE/PK declaration on a smaller subset of the columns of another UNIQUE/PK declaration. But then the latter won't be a candidate key.

这篇关于候选键的子集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆