【问题标题】:Need help figuring out Functional Dependencies需要帮助找出功能依赖关系
【发布时间】:2013-03-25 03:57:30
【问题描述】:

我有一个问题,他们要求我获取功能依赖项,但我不完全确定我是否正确理解了它们,这个话题似乎有点令人困惑,我想知道你们是否可以再次检查我或纠正我是否我错了!

Company(companyID, companyName, cityName, country, assets)
Department(deptID, deptName, companyID, cityName, country, deptMgrID)
City(cityID, cityName, country)

-Two different companies cannot have the same company ID
-Two different departments cannot have the same deptID
-Two different cities cannot have the same cityID
-Two different cities in the same country cannot have the same name.
-The company name and the city it’s located in determine the company ID.
-Two departments in the same company must have different names.
-One manager cannot run two different departments.

这些是我想出的 FD:

companyID -> companyName,cityName,country,assets
deptID -> deptName,companyID,cityName,country,deptMgrID
cityID -> cityName,country
country,cityID -> cityName
companyName,cityName -> companyID
deptID -> deptMgrID
deptID,country -> deptName

【问题讨论】:

    标签: functional-dependencies


    【解决方案1】:

    两个不同的公司不能有相同的公司 ID

    我认为这意味着 Company.companyID 是唯一的。 那个的意思是

    • companyID -> Company.companyName
    • companyID -> Company.cityName
    • companyID -> Company.country
    • companyID -> Company.assets

    两个不同的部门不能有相同的部门ID

    解释同上。 FD 应该很明显。

    两个不同的城市不能有相同的cityID

    相同的解释。同样,FD 应该是显而易见的。

    同一个国家的两个不同城市不能同名。

    我认为这意味着 {city name, country name} 是唯一的。这意味着它是一个候选键,而 that 意味着左侧有 cityID 的每个 FD 都可以在左侧用 {city name, country name} 重复。

    公司名称和所在城市决定了公司 ID。

    • companyName、cityName、country -> companyID

    同一公司的两个部门必须有不同的名称。

    我认为这意味着部门名称不是唯一的,而是 {companyID, deptName} 。这使得 {companyID, deptName} 成为候选键。因此,左侧具有 Department.deptID 的每个 FD 都可以与左侧的 {companyID, deptName} 重复。

    一个经理不能管理两个不同的部门。

    deptMgrID 是候选键。见上文。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-03
      • 1970-01-01
      • 2019-07-04
      相关资源
      最近更新 更多