Boyce Codd Normal Form?

时间:2014-06-25 08:37:16

标签: database database-design normalization bcnf

我想知道这些例子是否在BCNF中,以了解我是否正确地执行了这些操作。 关系:

Employee (EID, Ename, PID, ProjectName, MID, ManagerName) 

功能依赖:

EID==>(Ename, PID)
PID==>(ProjectName, EID, MID)
MID==>(ManagerName, PID)

BCNF关系:

Employees(EID,Ename, PID)
Project(PID, ProjectName)
Managers(MID, ManagerName, PID)

第二个例子

关系:

Pet (PID, Pname, Type, Breed, DOB, OwnerID, OwnerName, OwnerPhone,
     OwnerEmail, ServiceType, Date, Charge) 

功能依赖:

PID==>(Pname, Type, Breed, DOB, OwnerID)
OwnerID==>(OwnerName, OwnerPhone, OwnerEmail, PID)
ServiceType==>(Charge)

BCNF关系:

Pet(PID,Pname,Type,Breed,DOB)
Owner(OwnerID,  OwnerName, OwnerPhone, OwnerEmail, PID)
Service(ServiceType, PID, Date, Charge)

我是否正确地使用这些?

1 个答案:

答案 0 :(得分:0)

是的,这两个例子都在BCNF。

Employees(EID, Ename, PID)
Project(PID, ProjectName)
Managers(MID, ManagerName, PID)

没有功能依赖性,因此达到了BCNF。请注意,在此示例中,项目可以由许多经理领导,但经理只能领导一个项目。

Pet(PID ,Pname, Type, Breed, DOB)
Owner(OwnerID, OwnerName, OwnerPhone, OwnerEmail, PID)
Service(ServiceType, PID, Date, Charge)

这也是BCNF,因为属性没有依赖性会导致冗余。再次注意:同一只宠物可以由许多主人拥有,但主人只能拥有一只宠物。以下是一个例子,其中每只宠物仅由一位所有者拥有,一位拥有者可以拥有许多宠物:

Pet(PID, Pname, Type, Breed, DOB, OwnerID)
Owner(OwnerID,  OwnerName, OwnerPhone, OwnerEmail)
Service(ServiceType, PID, Date, Charge)