zoukankan      html  css  js  c++  java
  • BCNF范式及其分解方法(对一次Lab作业的总结)

    BCNF是比第三范式更严格一个范式。它要求关系模型中所有的属性(包括主属性和非主属性)都不传递依赖于任何候选关键字。也就是说,当关系型表中功能上互相依赖的那些列的每一列都是一个候选关键字时候,该满足BCNF。

    BCNF实际上是在第三范式的基础上,进一步消除了主属性的传递依赖。

    一次Lab的作业题目如下:

    A luxury car-rental company has been tracking their rental data in a simple spreadsheet, but now wants to migrate to a proper database. Consider the table given below, containing some sample data.

     (a) Identify at least 10 functional dependencies (non-trivial with minimal LHS) that hold on the table above.

    (b) Classify the functional dependencies found as either ‘sensible’ or ‘accidental’.

    给了个这个租车表,要求写函数依赖关系,这里只写sensible的,accidental的没有固定标准,不写。

    依赖如下:

    plate->make
    make ->daily_rate
    license_nr->dob
    license_nr->name
    plate+start_date ->*  (*表示除这两项之外的剩余部分都可以表示)

    考虑到一个人(一个驾照可以租很多车,所以还需要租车的开始时间或者结束时间来区分)

    其他的不用解释了

    这里为了突出传递函数依赖,将plate,make,daily_rate分开,理解为车牌号决定厂家,厂家决定该车型每日收入,同一车型收费应该都相同,所以为互相依赖。

    剩余的依赖关系都为部分函数依赖

    建表如下:

    建立4个表

    table1
    plate start_date end_date license_nr  (plate start_date为主键)

    table 2
    name dob license_nr  (license_nr为主键)

    table3和table4传递关系 分开写

    table 3
    plate make  

    table 4
    make daily_rate

    转载一篇博文,有关BCNF的分解算法的:

    https://blog.csdn.net/panxiqie___/article/details/38899021

    这里根据这个dalao写的试着分析一下自己的:

    plate->make
    make ->daily_rate
    license_nr->dob
    license_nr->name

    plate+start_date ->*  

    结束

  • 相关阅读:
    Gentoo 使用genkernel之后,修改了kernel,重新编译kernel和生成initramfs
    如何让git自动在commit message中加入你需要的sob?
    Gentoo:请安装bashcompletion package
    Kernel开发 SubmittingPatches,有关ifdef和static inline & macro
    Kernel开发 Thunderbird配置 From kernel documentation
    Gentoo 添加gentoozh overlay
    linux把文件压缩成.tar.gz的命令
    redhat下装ftp服务器(vsftpd)
    GDB调试精粹及使用实例
    linux中常用的头文件
  • 原文地址:https://www.cnblogs.com/northernmashiro/p/8981391.html
Copyright © 2011-2022 走看看