前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >找候选键 候选键的判定

找候选键 候选键的判定

作者头像
平凡的学生族
发布2019-05-25 10:09:07
1K0
发布2019-05-25 10:09:07
举报
文章被收录于专栏:后端技术

找出候选键的方法

First example

WHOSE

  • WH -> S
  • HOS -> E

Steps:

  1. Find the attributes that are neither on the left and right side(找到依赖两侧都没有的属性)

(none)

  1. Find attributes that are only on the right side (找到只在依赖右侧出现的属性)

E

  1. Find attributes that are only on the left side (找到只在依赖左侧出现的属性)

WHO

  1. Combine the attributes on step 1 and 3 (把第一步和第三步中找到的属性合并)

since step 1 has no attributes, it’s just WHO

  1. Test if the closures of attributes on step 4 are all the attributes (测试第四步中的属性 所形成的回路 是否就是所有属性)

in our case, yes it is. Because with WH we can get S, and by HOS, we can get E. So we have only one candidate key, that is WHO.

Third example

ABCD

  • ABC -> D
  • D -> A

Steps:

  1. BC
  2. BC
  3. The closure of BC is only BC, we should find the relation exterior.
  4. Find the relation exteriors, that is the attributes not included in step 4 and step 2.

in this example it is AD

  1. Now test the closures of attributes on step 4 + one attribute in step 6 one at a time.

ABC closures are ABCD, so it is a candidate key BCD closures are ABCD, so it is also a candidate key so in this case we have two candidate keys, they are ABC and BCD.

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2017.08.23 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • First example
    • WHOSE
    • Third example
      • ABCD
      领券
      问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档