决定因素和候选人键是相同还是不同的东西? [英] Are Determinants and Candidate Keys same or different things?

查看:492
本文介绍了决定因素和候选人键是相同还是不同的东西?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这里我找到了:




定义:数据库表中的决定因素是任何属性,您可以使用它来确定分配给其他
属性的值

考虑一个具有employee_id,first_name,last_name和date_of_birth属性的表。在这种情况下,字段
employee_id确定剩余的三个字段。名称字段做
不确定employee_id,因为公司可能有多个具有相同第一和/或姓氏的
雇员。类似地,DOB
字段不确定employee_id或名称字段,因为多于一个雇员的
可以共享相同的生日。


这个定义不适用于候选键吗?

解决方案

根据我的理解,如果表未被完全规范化,则为候选键。事实上,在描述将非正态数据转换为更有用的规范化形式的过程时,使用字行列式。



考虑这个(显然不正常)表:

  CREATE TABLE US_Address(
AddressID int,
Streetline varchar(80),
City varchar(80),
State char(2),
ZIP char(5),
StateName varchar(80),
StateTax DECIMAL(5,2)

State是StateName和StateTax的决定因素,但它不是行的候选键。
因此,正确的归一化会将StateName和StateTax移出US_Address表并进入States表。



有关详情,请参见此处


Here I found this:

Definition: A determinant in a database table is any attribute that you can use to determine the values assigned to other attribute(s) in the same row.

Examples: Consider a table with the attributes employee_id, first_name, last_name and date_of_birth. In this case, the field employee_id determines the remaining three fields. The name fields do not determine the employee_id because the firm may have more than one employee with the same first and/or last name. Similarly, the DOB field does not determine the employee_id or the name fields because more than one employee may share the same birthday.

Isn't the definition applicable for candidate keys too?

解决方案

From my understanding, a determinant may not be a candidate key if the table is not fully normalized. In fact, the word determinant is used when describing the process of taking non-normal data to a more useful, normalized form.

Consider this (obviously non-normal) table:

CREATE TABLE US_Address (
  AddressID int,
  Streetline varchar(80),
  City varchar(80),
  State char(2),
  ZIP char(5),
  StateName varchar(80),
  StateTax DECIMAL(5,2)
)

State is a determinant for StateName and StateTax, but it is not a candidate key for the row. Proper normalization, would therefore move StateName and StateTax out of the US_Address table and into a States table.

See here for more information.

这篇关于决定因素和候选人键是相同还是不同的东西?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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