2013-04-03 38 views
0

我有一个问题,他们要求我获得函数依赖关系,但我不完全确定如果我正确地得到它们,这个主题似乎有点混乱,我想知道你们是否可以复查对我来说还是纠正我,如果我错了,请!需要帮助搞清函数依赖关系

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. 

这些都是文件描述符,我想出了:

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 

回答

0

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

我解释这意味着公司。 companyID是唯一的。 这意味着

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

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

与上述相同的解释。 FD应该是显而易见的。

两个不同的城市可以有相同的cityID

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

在同一个国家的两个不同的城市不能有相同的名称。

我认为这意味着{城市名称,国家名称}是唯一的。这意味着它是一个候选键,而意味着左侧有cityID的每个FD都可以在左侧重复{城市名称,国家名称}。

公司名称和它所在的城市确定公司ID。

  • 公司名称,的cityName,乡村 - > companyID

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

我解释这意味着该部门的名称不是唯一的,但是{companyID,DEPTNAME} 。这使得{companyID,deptName}成为候选键。因此,左侧的Department.deptID的每个FD都可以在左侧的{companyID,deptName}中重复使用。

一位经理不能运行两个不同的部门。

deptMgrID是候选关键字。往上看。